VAR vs Dynamic in C# | C# Interview Questions | CSharp Interview Questions

  Рет қаралды 48,515

Questpond

Questpond

Күн бұрын

Пікірлер: 46
@questpondvideos
@questpondvideos 3 жыл бұрын
30 Important C# Interview Questions : kzbin.info/www/bejne/eHzcn3h4hdacf68 Software Architecture Interview Questions : kzbin.info/www/bejne/d6W3mJaYgbSkg68 25+ OOPS Interview Questions : kzbin.info/www/bejne/q2qcqHSld893rLM 20+ SQL Server Interview Questions : kzbin.info/www/bejne/iXbHcnluorh-iZY 10+ Power BI Interview Questions : kzbin.info/www/bejne/eaDdlGyNg6eFqpY 20 MSBI Interview Questions : kzbin.info/www/bejne/hKjCpHt7gNOCi6c SQL Server Joins : kzbin.info/www/bejne/gYXZint7o9mppJo SQL Step by Step - kzbin.info/www/bejne/q3jPl4NvpJyeo7s Angular Step by Step Tutorial for Beginners : kzbin.info/www/bejne/Y2q5lIptgqd3qZo 25 Angular Interview Questions : kzbin.info/www/bejne/Y5vIoKx6f6mmia8 25 Important ASP.NET Interview Questions : kzbin.info/www/bejne/ponQfpejf7p2Zsk 35 Important JavaScript Interview Questions : kzbin.info/www/bejne/kJOXlYOfbKh0hLc 20 MySQL Interview Questions : kzbin.info/www/bejne/b5nJm3Zjd9WMaJI 5 MSBI Interview Questions : kzbin.info/www/bejne/a3abYmiXjaaqj7M
@RikinPatel13
@RikinPatel13 2 жыл бұрын
One more diff. >> You can change type of dynamic variable where as var you can not change type of variable. E.g var x= 10; x="test"; ❌️ dynamic y=10; y="test"; ✅️
@seanishok04
@seanishok04 3 жыл бұрын
This seems to be simple one line explanation. Please explain some pros and cons and also in what scenarios we use Var and Dynamic keywords.
@ALLCPL
@ALLCPL 3 жыл бұрын
Ok
@reazuddinahmed1080
@reazuddinahmed1080 3 жыл бұрын
You are more than outstanding teacher... The best teacher of the planet...
@ALLCPL
@ALLCPL 3 жыл бұрын
Same here
@bharathyadav3614
@bharathyadav3614 3 жыл бұрын
Also var should be initialised at the time of declaration, dynamic may not be. Example: var name = “Bharath”; ✅ var name; ❌ dynamic value = 100; ✅ dynamic value; ✅
@ankmeyester
@ankmeyester 3 жыл бұрын
You're very knowledgeable sir. Thank you 🙏
@questpondvideos
@questpondvideos 3 жыл бұрын
Thats natural if you do not have value assigned compiler will not know the data type.
@ALLCPL
@ALLCPL 3 жыл бұрын
Good
@devaranji6647
@devaranji6647 3 жыл бұрын
Var determines things during compile time .its statically typed. While dynamic determines types during runtime .its dynamically typed
@balasenk
@balasenk 3 жыл бұрын
As you said, I have never used dynamic in the project but if I had an interview will definitely end up in negative, thanks for your great explanation.
@praveens4770
@praveens4770 3 жыл бұрын
Lol 😂
@ALLCPL
@ALLCPL 3 жыл бұрын
☺️
@delhitepawan5804
@delhitepawan5804 3 жыл бұрын
Shiv ji, Request you to give some real world application so we can understand it better 🙏
@abissqlabissql6003
@abissqlabissql6003 3 жыл бұрын
Super Duper....As usual rocking lesson.
@mohdaasif007
@mohdaasif007 2 жыл бұрын
Best answer for interview 👍
@imranamin369
@imranamin369 Жыл бұрын
If var is static and detrmine the type at compile time then why don't we declare a variable with the same type as on right side. Say var i = 123 to int i = 123. In this way var has no need to be used instead of the desired type
@hemantha6468
@hemantha6468 Жыл бұрын
Same doubt for me tooo. If you got any clarification on this please let me know ..
@shaiksha229
@shaiksha229 Жыл бұрын
int i=10; i = 20; Possible...but var i =10; i = 20; // it doesn't work
@imranamin369
@imranamin369 Жыл бұрын
@@shaiksha229 Then why don't we use const instead of var. I mean what is the benifit of var rather that const if they are same in behavior
@shaiksha229
@shaiksha229 Жыл бұрын
​@@imranamin369 const is limited to certain types like primitive and strings. In simple, use const when you have value of primitive/string, use var if you want your complier to infer the type and you can use var for any type not just limited to primitive and strings. Hope you are clear with this
@thefattysplace
@thefattysplace 3 жыл бұрын
I still think the best option is to not use var or dynamic, but just declare it using the correct type to start off with.
@amanagrawal7699
@amanagrawal7699 2 жыл бұрын
Q1. When we should use Dynamic keyword in our code?
@kishanchetry3826
@kishanchetry3826 3 жыл бұрын
Simple nd interesting logic behind var & dynamic..👍
@siestitrokot3843
@siestitrokot3843 3 жыл бұрын
Great tutorials. Microsoft should hire you to rewrite them their complete documentation. Thank you
@bishwajeetanand9048
@bishwajeetanand9048 3 жыл бұрын
Well explained
@rishavraj3127
@rishavraj3127 2 жыл бұрын
Nice
@armsolutions1165
@armsolutions1165 3 жыл бұрын
It Useful for me
@ALLCPL
@ALLCPL 3 жыл бұрын
Yes same here
@jayandrapatil
@jayandrapatil Жыл бұрын
There are many thing's people ask in interviews but hardly use them in projects. I'm sure there are 90% people doing cut, copy, paste in the projects.
@sidharthmahapatra3359
@sidharthmahapatra3359 Жыл бұрын
When to use var keyword and when to use dynamic keyword?
@rajir6429
@rajir6429 3 жыл бұрын
Hi sir, in angular, how inherit class and how to send new input data from UI to database. kindly clarify me
@ALLCPL
@ALLCPL 3 жыл бұрын
Yes
@XabierLorente
@XabierLorente 3 жыл бұрын
HI! thank you for your videos. Last version of visual studio suggest (rigth button-> quick actions) replacing var for the real type. So, looks like they want to deprecate var keyword? Thank you again, very good work!
@aniljha6106
@aniljha6106 3 жыл бұрын
You have missed to cover when to use what
@Nicetrycutiepie
@Nicetrycutiepie 3 жыл бұрын
then what is the benfit of Dynamic
@JonasDonald
@JonasDonald 3 жыл бұрын
How does she compiler figure out the type for i if it doesn't know what y.Length is?
@questpondvideos
@questpondvideos 3 жыл бұрын
She :-) uses reflection internally.
@afsalc9674
@afsalc9674 3 жыл бұрын
record vs dynamic C#
@cubanlincoln1767
@cubanlincoln1767 Жыл бұрын
MIrosoft is crazy: First: Javascript does not have strong type variables, this is a big mistake, let's solve this creating Typescript, a strong type Javascript Later: C# does not have dynamic types in variables(the reason the created Typescript), lets introduce this into C# WTF
@mikeraz594
@mikeraz594 3 жыл бұрын
var and dynamic are the 2 worst concepts ever added to any langauge
@abissqlabissql6003
@abissqlabissql6003 3 жыл бұрын
And interviewers make out life worst asking these questions during interview sad state of affair :-)
@srinivasrao7794
@srinivasrao7794 2 жыл бұрын
Always your videos there is no real info, kids also knows what is var and dynamic. You need to provide info for why to use dynamic.
@questpondvideos
@questpondvideos 2 жыл бұрын
Quiet to sad to see you think this is for kids.Must be you are genius. But many still do not know the basic difference. Happy learning
@HolyRamanRajya
@HolyRamanRajya 2 жыл бұрын
Agreed with srinivas, not only no real info most of the video, when the real info drops its wrong and uploader is a lazy eff who can't re-record a short 6minute video.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Dynamic Vs Var in C#
28:27
IAmTimCorey
Рет қаралды 62 М.
C# Out parameters Vs REF parameters
6:43
.NET Interview Preparation videos
Рет қаралды 289 М.
LINQ in C# - Top 10 concepts everyone should know 🔥
17:54
The Engineer's Desk
Рет қаралды 28 М.