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:
    2
    Trophy Points:
    0
    Just having the get/set methods would do.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice