30 Important C# Interview Questions : kzbin.info/www/bejne/eHzcn3h4hdacf68 25+ OOPS Interview Questions : kzbin.info/www/bejne/q2qcqHSld893rLM Software Architecture Interview Questions : kzbin.info/www/bejne/d6W3mJaYgbSkg68 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 20 PHP Interview Questions : kzbin.info/www/bejne/Z5PTf4avo7qlopo
@zerosandones75473 жыл бұрын
Constants: Constants based on "consts": - const fields are called compile-time constants - an absolute constant - the value of a const variable is set during the declaration itself - consts variables SHOULD have a value when declared - the const's value is stored in the IL code itself Constants based on "readonly": - the modifier readonly creates fields, which values cannot be changed once they are assigned. - don't need to define a value during the declaration itself (a readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer)) - readonly fields are called run-time constants - their values cannot be changed after assignment - this process(value assignment) happens during the execution of the program (in runtime)
@klocugh123 жыл бұрын
You didn't mention one thing about const: Compiler actually writes literal value of const as is when compiling. So there is no variable in memory, just a literal 100 number. It is important when you use it in other assemblies. When you modify it where it's defined, other assemblies will still hold value it had when it was compiled, so they have to be recompiled again!
@expertreviews11128 жыл бұрын
absolutely fantastic video. goodness me such good explanation. Be Blessed
@dnskk8 жыл бұрын
sir const are implicitly static so u need not to put static in front of them
@RohanShirodkar294 ай бұрын
Thanks for sharing this informatational video
@faisalraufpitafi13966 жыл бұрын
sir Aslam o alikum I am from Karachi Pakistan I like your teaching way Mashallah Mashallah you are perfect teacher and I will share your videos with my friends because I want they should learn .
@HikeThePlanets4 жыл бұрын
Thanks so much for explaining that so simply and thoroughly.
@nocultist70503 жыл бұрын
This is a hidden gem of a channel.
@mradosovic3 жыл бұрын
Very nice explanation with a good example.
@harshsaxena052 жыл бұрын
excellent explanation thank you.
@pcm0it11 жыл бұрын
The static modifier is not allowed in a constant declaration.
@olglez92303 жыл бұрын
Nice one. Very clearly explained with a good example. This may come up on an interview open day!
@amolshinde78323 жыл бұрын
Very good explanation, thanks
11 жыл бұрын
Very helpful. Thank you. Never really understood the point of readonly until now.
@questpondvideos4 жыл бұрын
New Announcement from Questpond ".NET(C#) FUNDAMENTALS, .NET COLLECTIONS, GENERICS" Course now available @ 799 /12 $. If Interested visit this Link for Subscription with Questpond www.questpond.com/netc-fundamentals-net-collections-generics/cid22
@venkateshpillay32132 жыл бұрын
Great sir 👌 Thank you
@marklitvin92917 жыл бұрын
Very well explained. Thank you!
@aks-tech-16 жыл бұрын
I have one suggestion here. You can brief the topic and then explain the programming. You are good in all the way. I am your paid user
@Shakti_Singh_Om3 жыл бұрын
Important point here is that constants are by default static. You can use static keyword with Readonly and not with constants.
@sery1525 жыл бұрын
Can you explain the logic of static inline with const and readonly, they have contradictins...
@rjshukla_vlogs8 жыл бұрын
Hello Sir ji .. Its really nice example but i have 1 question here that we can't have static and const simultaneously ?? it is saying that you cant have static with the const ? Could you please let me know how this happens in your example ?? Thanks you so much for your help :)
@AachaLagaNa8 жыл бұрын
Seems that code is written in text editor not in any fiddler or vs ide.
@rjshukla_vlogs8 жыл бұрын
But while. Running the application how it is showing the correct output.
@tusharghude157 жыл бұрын
watch carefully he changed it (at 05:48 u can see suddenly public and static disappeared) ur rgt constants cannot be declared as static coz they are implicitly static u always use const like classname.const_var
@vatansoni64397 жыл бұрын
+tushar ghude good
@dineshkumarachari8757 Жыл бұрын
@@tusharghude15 correct! but he not mention that point is important point.
@kavithan19875 жыл бұрын
Instead of read-only we can use integer right..is their any difference in memory allocation
@naterdanger39196 жыл бұрын
Forgive me if this was asked already, but is it necessary to label it constant to begin with? Why/When would we need to do such a thing?
@jvsnyc6 жыл бұрын
It is to protect you against goofy mistakes by yourself or others on your team. If something is logically a compile-time constant (or even readonly) if you try to change it later by mistake you can't. There are also optimizations that can be applied to values known not to change, but that is secondary.
@rohitjoshi32403 жыл бұрын
You declare the static Constructor and used the access modifier, which prone to error.
@saurabhmahal135411 жыл бұрын
Great way to tell the difference ...thanks
@rajarajanseeman67588 жыл бұрын
Still wondering how would you be able to mark as static in const variable? I see the below error Error 1 The constant 'xxx.Program.myproconst' cannot be marked static
@AachaLagaNa8 жыл бұрын
Seems that code is written in text editor not in any fiddler or vs ide.
@jvsnyc6 жыл бұрын
If it is not clear to anyone, that's right, it can't. Doubly confusing for C++ programmers coming over to C# because in C++ const has a different meaning and does not automatically imply static. In C# it appears const implies static and you can't say both just for fun or to be more clear. In C++ the same thing would be static const, because if you said just const you would get one for each object instance. C# has a readonly keyword that doesn't exist in C++.
@sandeepadode16 жыл бұрын
My question is why to read only?A constant is constant right be it at compile time or at run time.Does it have any impact on the program?please help.What exactly is the use of using anyone among them?
@jvsnyc6 жыл бұрын
It is to protect you against goofy mistakes by yourself or others on your team. If something is logically a compile-time constant (or even readonly) if you try to change it later by mistake you can't. There are also optimizations that can be applied to values known not to change, but that is secondary.
@manjeetnandal15 жыл бұрын
Great sharing! Thanks....
@pankajjha19144 жыл бұрын
thnku sir.
@PanikGrafik2 жыл бұрын
Dont forget that the value IS STILL HELD !!!
@Albileon11 жыл бұрын
Really good, thanks.
@ahmadezzat90316 жыл бұрын
The const is by default static.
@prateekbhardwaj99438 жыл бұрын
nicely explained
@ankitsinha0073 жыл бұрын
A static constructor does not have access modifier
@zerosandones75473 жыл бұрын
static constructor in IL code is cctor
@MrJonnis137 жыл бұрын
Thank you
@yeshyuvi12 жыл бұрын
its good and thank u
@smanputra11 жыл бұрын
great explanation and examples..
@williamwang204710 ай бұрын
i think u said wrong, PI should be const, as it never changed......
@codewithparveenyadav7 жыл бұрын
useful
@semikolon42296 жыл бұрын
thanks, very useful
@hlch77742 жыл бұрын
const no need to use static
@lakshmisruthi13423 жыл бұрын
I wish I watched this video before attending interview :/
@wiepcorbier5 жыл бұрын
Stop the "you know" please.
@naturebc Жыл бұрын
This is one of those things that makes a language worse. More complex for no good reason at all.