CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Posts
    8

    Key from List of EnumeratedValues

    Hi,

    I am beginner in c#. I have List of EnumeratedValues, I need to get the key and assign to some other string. Can anybody help me on this.

    Thanks,
    Genith

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Key from List of EnumeratedValues

    Can you post some code on what you have?

  3. #3
    Join Date
    May 2012
    Posts
    8

    Re: Key from List of EnumeratedValues

    Hi Arjay,

    Here is my EnumeratedValue

    public class EnumeratedValue
    {

    public string ParentKey { get; set; }
    public string Value { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public string Type { get; set; }
    public string Key { get; set; }
    public string ParentType { get; set; }

    }

    I am already using Name from Store proc.

    public List<EnumeratedValue> AvailabeNames
    {

    }

    I am assigning for this AvailabeNames in service. I need to access key form AvailabeNames.

    Thanks

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Key from List of EnumeratedValues

    Code:
    foreach( var availableName in AvailableNames)
    {
      var key availableName.Key;
    }
    If you want to find an AvailableName entry by a key, then you may want to use a Dictionary<> collection instead of a List<>.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured