• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

Error Messages Appearing in Class Design

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
thenthorn1010
Asked:
thenthorn1010
  • 2
2 Solutions
 
ambienceCommented:
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
 
Bob LearnedCommented:
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
 
ambienceCommented:
how was 37815812 relevant or different? oh well ...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now