Monday 10 December 2018

Different between var and Dynamic Variable in C#.

var  It is introduced  C#3.0 Version.
 dynamic It is introduced  C# 4.0 version

1).Var is statically  type of variable, where are dynamic is dynamically type of variable.

2)Errore will be occur at compile time in var, where as error will be occur at runtime
.
3)In var initialization is required at time of declaration. If you not initialize variable it will be throw error at compile time "Implicitly -typed variable must be initialized ". where as dynamic type variable initialization is not required at time of declaration.

4)var does not allow the change variable after assigned value where as dynamic type variable allow be change type after assigned .

5)var support intellisense because it arise errore at compile time where as dynamic type  variable not support intelligence because type is unknown runtime.

6)var variable can not be used for properties and return value from function .it is available only locally whereas dynamic variable can be used to create properties and return value from function





How to get logged in User's Security Roles using Java Script in dynamic CRM 365.

 function GetloggedUser () {     var roles = Xrm.Utility.getGlobalContext().userSettings.roles;      if (roles === null) return false;      ...