list (List) where the first value has supported repeated

Posted on 2008-11-14
Last Modified: 2013-11-07
good night, I need to create a list (List) where the first value has supported repeated, for example
1, aaaa
1, bbbb
1, cccc
also to indicate as those values can be read
Question by:enrique_aeo
    LVL 12

    Expert Comment

    Can you describe this a little bit more?
    LVL 26

    Expert Comment

    by:Anurag Thakur
    you can create a class with two members and add that class in list

    class test
       public int i;
       publci text = string.Empty;
       public test()

        public void test(int I, string Text)
            i = I;
            text = Text;

    List <test> list = new List<test> ();
    list.Add(new text(1, "aaaa");
    list.Add(new text(1, "bbbb");
    list.Add(new text(1, "cccc");

    Author Comment

    Hi, i have this error (view file)
    LVL 26

    Accepted Solution

    i didnt paste the complete working code
    i just gave you the prototype of the class which you can use to add in a generic list <T> and then you have use the bottom addition into the list to add to the list items and then later bind that to the dropdown

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Help needed on website authentication 7 37
    ASP.NET MVC Edit ViewModel Data 6 24
    c# string 6 27
    Sort Datagrdview programmatically 19 25
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 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

    19 Experts available now in Live!

    Get 1:1 Help Now