Wednesday, 11 January 2017

Differences


  1. Difference between count(*) and count(1)
  • COUNT(*) returns the number of items in a group. This includes NULL values and duplicates.
  • COUNT(1) returns the number of items in a group. This includes NULL values and duplicates.
  • COUNT(ALL expression) evaluates expression for each row in a group and returns the number of nonnull values.
  • COUNT(DISTINCT expression) evaluates expression 

  1. Hashtable vs. Dictionary 
  • Dictionary:

    • It returns error if we try to find a key which does not exist.
    • It is faster than a Hashtable because there is no boxing and unboxing.
    • Only public static members are thread safe.
    • Dictionary is a generic type which means we can use it with any data type.

    Hashtable:

    • It returns null if we try to find a key which does not exist.
    • It is slower than dictionary because it requires boxing and unboxing.
    • All the members in a Hashtable are thread safe,
    • Hashtable is not a generic type.
  • Difference Between IS and AS
                          //  IS str1 variable type of string

                        ISkeyword is used to check the varaibles are same type or not
                        object str1=123;
                       if(str1 is string)
                            {
                                    c.w.l("This is of same type");
                             }

                      As keyword is helps to convert object one type to other type

                      string x=str1 as string
  • Difference Between Ref and Out
  • Difference Between Async and Await
  1. async and await are markers,which mark code positions from where control should resume after task(thread) completes
    EX: Public staticasync void method()
      {
        await Task.run(new Action(LongTask)
          C.W.L("New Thread");
            }
              Public staticvoidLongTAsk()
                {
                  Thread.sleep(20000);
                    }
                    • Difference Between Constant and readonly
                    • Difference Between var and Dynamic
                    • Private constructor
                    • Difference Between Throw and Throw ex

                                          No comments:

                                          Post a Comment