Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error Messages Appearing in Class Design

Posted on 2012-04-05
3
Medium Priority
?
398 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 1000 total points
ID: 37815675
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 1000 total points
ID: 37815812
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
ID: 37823334
how was 37815812 relevant or different? oh well ...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

972 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