Solved

Error Messages Appearing in Class Design

Posted on 2012-04-05
3
390 Views
Last Modified: 2012-04-09
I am attempting to write a C# class that will be used in addition to several other smaller classes to make up a larger business entity. I have written a sample class, and I am getting error messages before I run the code when I am attempting to design it. I am receiving the following error messages below. I have attached the sample class that I have written for my one part of my structure below the errors. Could someone help me figure out why I am receiving the error messages when I am attempting to design the basic class? Any help would be greatly appreciated.

Error      1      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      32      18      EOISampleDesign
Error      2      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      33      18      EOISampleDesign
Error      3      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      34      18      EOISampleDesign
Error      4      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      35      18      EOISampleDesign
Error      5      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      36      18      EOISampleDesign
Error      6      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      37      18      EOISampleDesign
Error      7      'EOISampleDesign.EOIBusinessEntity.PolicyHolder' does not contain a definition for 'FromXml' and no extension method 'FromXml' accepting a first argument of type 'EOISampleDesign.EOIBusinessEntity.PolicyHolder' could be found (are you missing a using directive or an assembly reference?)      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      48      38      EOISampleDesign
Error      8      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      49      18      EOISampleDesign
Error      9      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      49      47      EOISampleDesign
Error      10      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      50      18      EOISampleDesign
Error      11      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      50      37      EOISampleDesign
Error      12      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      51      18      EOISampleDesign
Error      13      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      51      39      EOISampleDesign
Error      14      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      52      18      EOISampleDesign
Error      15      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      52      30      EOISampleDesign
Error      16      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      53      18      EOISampleDesign
Error      17      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      53      31      EOISampleDesign
Error      18      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      54      18      EOISampleDesign
Error      19      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      54      33      EOISampleDesign
Error      20      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      63      31      EOISampleDesign
Error      21      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupPolicyholderName'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      64      24      EOISampleDesign
Error      22      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      69      31      EOISampleDesign
Error      23      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.groupNumber'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      70      24      EOISampleDesign
Error      24      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      76      31      EOISampleDesign
Error      25      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.streetAddress'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      77      24      EOISampleDesign
Error      26      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      82      31      EOISampleDesign
Error      27      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.city'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      83      24      EOISampleDesign
Error      28      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      88      31      EOISampleDesign
Error      29      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.state'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      89      24      EOISampleDesign
Error      30      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      94      31      EOISampleDesign
Error      31      Ambiguity between 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode' and 'EOISampleDesign.EOIBusinessEntity.PolicyHolder.zipCode'      C:\Documents and Settings\TLHN\my documents\visual studio 2010\Projects\EOISampleDesign\EOISampleDesign\EOIBusinessEntity\PolicyHolder.cs      95      24      EOISampleDesign

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic;

namespace EOISampleDesign.EOIBusinessEntity
{
    public class PolicyHolder
    {
        #region Private Variables
        private string groupPolicyholderName;
        private string groupNumber;
        private string streetAddress;
        private string city;
        private string state;
        private string zipCode;

        #endregion


        #region Constructors
        
        /// <summary>
        /// Default constructor.
        /// </summary>
        public PolicyHolder()
        {
            this.groupPolicyholderName = "";
            this.groupNumber = "";
            this.streetAddress = "";
            this.city = "";
            this.state = "";
            this.zipCode = "";
        }


        /// <summary>
        /// Constructor building the intstance from the Xml string.
        /// </summary>
        /// <param name="xmlString"></param>
        public PolicyHolder(string xmlString)
            : this()
        {
            PolicyHolder temp = this.FromXml(xmlString);
            this.groupPolicyholderName = temp.groupPolicyholderName;
            this.groupNumber = temp.groupNumber;
            this.streetAddress = temp.streetAddress;
            this.city = temp.city;
            this.state = temp.state;
            this.zipCode = temp.zipCode;

        }
        #endregion


        #region Public Properties
        public string groupPolicyholderName
        {
            get { return this.groupPolicyholderName; }
            set { this.groupPolicyholderName = value; }
        }

        public string groupNumber
        {
            get { return this.groupNumber; }
            set { this.groupNumber = value; }
        }


        public string streetAddress
        {
            get { return this.streetAddress; }
            set { this.streetAddress = value; }
        }

        public string city
        {
            get { return this.city; }
            set { this.city = value; }
        }

        public string state
        {
            get { return this.state; }
            set { this.state = value; }
        }

        public string zipCode
        {
            get { return this.zipCode; }
            set { this.zipCode = value; }
        }

        #endregion
    }
}

Open in new window

0
Comment
Question by:thenthorn1010
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
ambience earned 250 total points
Comment Utility
The problem is that you are using the same names for datamembers and property names

        private string groupNumber;
        public string groupNumber
        {
            get { return this.groupNumber; }
            set { this.groupNumber = value; }
        }

So how does the compiler know whether the bolded line is referring to the field or the property. Try changing the names for dataMembers like

        private string _groupNumber;
        public string groupNumber
        {
            get { return this._groupNumber; }
            set { this._groupNumber = value; }
        }

OR you can just let the compiler emit fields automatically. Delete all datamembers and change your Properties to

        public string groupNumber
        {
            get;
            set;
        }

The compiler will see that you want it to use vanilla wrappers and supply fields to back.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 250 total points
Comment Utility
Without really digging through all that code (not my favorite task), I would suggest that any ambiguity errors are based on the fact that the compiler could resolve multiple classes with the same methods and signature.  That can be overcome by fully qualified the namespace, or removing any using statements that create the conflict.
0
 
LVL 22

Expert Comment

by:ambience
Comment Utility
how was 37815812 relevant or different? oh well ...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now