1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C# Intervew Question Need Help

Discussion in 'C#' started by jacfrost, Jun 24, 2010.

  1. jacfrost

    jacfrost New Member

    Joined:
    Jun 24, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi - can anyone help with this interview question :


    1) Consider the following class (User). Provide a class with 3 methods:
    "AddUser" accepts a User instance as a parameter and add it to a collection.
    "GetUser" accepts a UserID as a parameter and returns the corresponding User instance.
    "GetOrderedUserArray" returns an array of User instances ordered by UserID.


    ######################
    Code:
    public class User
    {
       public int UserID;
       public string FamilyName;
       public string GivenName;
    
       public User(int userID, string familyName, string givenName)
       {
          UserID = userID;
          FamilyName = familyName;
          GivenName = givenName;
       }
    }

    THANKS
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    1
    Trophy Points:
    0
    Just having the get/set methods would do.
     

Share This Page