C# Interview question :- VAR vs Dynamic

preview_player
Показать описание
Avail latest C# Interview Questions : -

Also see our other Step by Step video series below :-

For more details :-
📱 Mob. No. : +91-9967590707 / +91 7700975156 / +91-22-49786776

Share, Support, Subscribe and Connect us on!!!

#csharpinterviewquestions #varvsdynamic #varincsharp #dynamicinc# #varvsdyanmicincsharp
Рекомендации по теме
Комментарии
Автор

Also i would like to add to every ones comment comparing VAR with Dynamic is like comparing apples with monkeys. VAR should be used only when you do not know what the right side data type can be like complex LINQ queries and

Dynamic ( cover on reflection) should be used when things will be know only during runtime like you get a object from a network serialized and you want to invoke methods.

questpondvideos
Автор

var is statically typed and dynamic is dynamically typed. The type of the variable is decided by the compiler at the compile time and the type of the variable is decided by the compiler at the run time.

saibamurmu
Автор

Car is intialise at compile time, dynamic intialise at run time, and hence dynamic is unable to show error when u build the project but car is able to show errors alwhen u tried build project

letitbe
Автор

Veriable is decided by the compiler at compile time for Var and veriable is decided by the compiler at run time for dynamic variable

kazimahebubalam
Автор

Var keyword decides the object type based on assignment at compile time whereas dynamic keyword decides the object type at runtime.

ranimiyer