This was an interview question I was asked. I wasn't sure about the answer.
In C# Both const and static member varables can:
A) Be set in a static constructor, static method, or instance method of a class.
B) Change after a class has been initialized the first time.
C) Only be set in an instance constructor.
D) Be accessed without an instance of a class.
E) Be set by a set accessor of a public property.
I chose "A" even though I was unsure what they meant. I didn't know whether to pick A or E. Since I was running out of time I picked A. I probably should have picked E.
A) My problem with this one is that it says "instance method."
B) They don't change - False
C) Is the constructor of a static method or class called an "Instance Constructor?" I know you can have a static constructor.
D) How can you access a constant without an instance? - FALSE
E) Not sure. I guess this could be true.
Can someone explain? thanks!
D). Because all the other answers will either prove not true for either one (or both).