C# Interview Question and Answers
26. |
What is the difference between const and static readonly? |
|
The difference is that static read only can be modified by the containing class, but const can never be modified and must e initialized to a compile time constant.
To expand on the static read only case a bit, the containing class can only modify it:
- in the variable declaration ( through a variable initialize)
-
in the static constructor (instance constructor if it's not static)
|
|
|
27. |
Is it possible to have a static indexer in C#? |
|
No. Static indexers are not allowed in C#. |
|
|
28. |
What namespaces are necessary to create a localized application? |
|
System.globalization and System.Resources
|
|
|
29. |
How are struts different from classes? |
|
Structs are stored on the stack as opposed to the heap. Structs are value types rather than reference types.
|
|
|
30. |
Does C# support multiple inheritance? |
|
C# supports multiple inheritance of interfaces, but not of classes. |
|
|