You need to add a user to the UserTracker instance

You are developing an application that includes a class named UserTracker. The application includes the
following code segment. (Line numbers are included for reference only.)

You need to add a user to the UserTracker instance.
What should you do?

You are developing an application that includes a class named UserTracker. The application includes the
following code segment. (Line numbers are included for reference only.)

You need to add a user to the UserTracker instance.
What should you do?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Swapnil

Swapnil

public delegate void AddUserCallback(int i);
public class User
{
public User(string name)
{
Name = name;
}
public string Name { get; set; }
}
public class UserTracker
{
List user = new List();
public void AddUser(string name,AddUserCallback callback)
{
user.Add(new User(name));
callback(user.Count);
}
}
class Program
{
static void Main(string[] args)
{
UserTracker tracker = new UserTracker();
tracker.AddUser(“Sachin”, delegate (int i)
{
Console.WriteLine(“Count :” + i);
});
tracker.AddUser(“SAurav”, delegate (int i)
{
Console.WriteLine(“Count :” + i);
});
Console.ReadLine();
}
}

D is Right