DIFFERENCE BETWEEN KEYWORDS ‘VAR’ AND ‘DYNAMIC’ ?
A. ‘Var’ is introduced in C# (3.0) and ‘Dynamic’ is introduced in C# (4.0)
B. ‘Var’ is a type of variable where declaration is done at compile time by compiler while ‘Dynamic’ declaration is achieved at runtime by compiler
C. For ‘Var’ Error is caught at compile time and for ‘Dynamic’ Error is caught at runtime
D. For ‘Var’ datatype the code as : var obj1 = 1; and var obj1=”I am a string” will also compile safely.For ‘Dynamic’ datatype the code as: dynamic obj1 =1; and dynamic obj1 = “I am a string” will create an error
Answer:A
DIFFERENCE BETWEEN KEYWORDS ‘VAR’ AND ‘DYNAMIC’ ?
A. ‘Var’ is introduced in C# (3.0) and ‘Dynamic’ is introduced in C# (4.0) B. ‘Var’ is a type of variable where declaration is done at compile time by compiler while ‘Dynamic’ declaration is achieved at runtime by compiler C. For ‘Var’ Error is caught at compile time and for ‘Dynamic’ Error is caught at runtime D. For ‘Var’ datatype the code as : var obj1 = 1; and var obj1=”I am a string” will also compile safely.For ‘Dynamic’ datatype the code as: dynamic obj1 =1; and dynamic obj1 = “I am a string” will create an error