PrepAway - Latest Free Exam Questions & Answers

13 Comments on “Hot Area:

  1. z1ppz says:

    class Program
    {
    public static Object GetTypeDefault(DbType dbDataType)
    {
    switch (dbDataType)
    {
    case DbType.Boolean:
    return false;
    case DbType.DateTime:
    return DateTime.MinValue;
    case DbType.Decimal:
    return 0m;
    case DbType.Int32:
    return 0;
    case DbType.String:
    return String.Empty;
    default:
    return null;
    }
    }

    public static void Main()
    {
    Console.WriteLine(“Type the number of the desired DbType”);
    Console.WriteLine(“Choose between Boolean (3), DateTime (6), Decimal (7), Int32 (11), String (13)”);
    int a;

    a = Convert.ToInt32(Console.ReadLine());

    var answer = GetTypeDefault((DbType)a);

    Console.WriteLine(answer == null
    ? “Default: null”
    : $”The specified number represents the following answer: {Convert.ToString(answer)}”);
    Console.ReadKey();
    }
    }




    0



    1

Leave a Reply