PrepAway - Latest Free Exam Questions & Answers

You are building a data access layer in an application that contains the following code:

HOTSPOT
You are building a data access layer in an application that contains the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

PrepAway - Latest Free Exam Questions & Answers

Answer:

3 Comments on “You are building a data access layer in an application that contains the following code:

    1. J says:

      Here the test:

      public static void Main(string[] args)
      {
      // DateTime
      Console.WriteLine(GetTypeDefault(DbType.DateTime));
      // Int64
      Console.WriteLine(GetTypeDefault(DbType.Int64));
      // Double
      Console.WriteLine(GetTypeDefault(DbType.Double));
      }

      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:
      // Code modified for a better understanding of the test.
      return “null”;
      }
      }




      1



      0

Leave a Reply