tag:blogger.com,1999:blog-5293170547243074820.post8714760678119642873..comments2023-12-31T07:07:03.305-08:00Comments on ... A developer's blog: C# keywords rarely known but frequently asked in Interview Questionscshandlerhttp://www.blogger.com/profile/04389413799333478945noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5293170547243074820.post-62872921811427339352012-06-20T11:05:16.445-07:002012-06-20T11:05:16.445-07:00Great article! Thanks!
And @above comment... I di...Great article! Thanks!<br /><br />And @above comment... I did not know that about the consts referred in other assemblies!!<br /><br />- Raman (Nagarro)Indianhttps://www.blogger.com/profile/06975751877535551241noreply@blogger.comtag:blogger.com,1999:blog-5293170547243074820.post-19233550720475112152011-09-08T17:36:56.082-07:002011-09-08T17:36:56.082-07:00Firstly, it never ceases to amaze me that people a...Firstly, it never ceases to amaze me that people ask syntax questions in interviews :-)<br /><br />Anyway, I thought I would add some concepts that might further clarify some of these points.<br /><br />Volatile, you definition is good. But to add further, in practice I believe the root cause of the problem it alleviates is the cpu cache having a stale value, eg it alleviates the case where one thread updates the value, but another thread gets the stale value from the cache.<br /><br />Const vs Readonly. Correct, compile time vs runtime. A real example of this scenario is where you have a multi-assembly application. If a class library (A) in one assembly exposes a const that is referenced in another assembly (B), the const value is compiled into the assembly B as a literal. So, if you released a new version of assembly A without recompiling Assembly B and the const value was changed, that changed const would not be reflected in assembly B as it will still have the original value from when it was compiled.Trend Driven Developmenthttps://www.blogger.com/profile/13971445110740402485noreply@blogger.com