Hi,
Which spec you are talking about? I have version 1.2 in word format as well
as in my MSDN library. Both are talking about Enum.
So, could you point me to the spec you are talking about?
Thanks
SN
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Subramaniyan Neelagandan <su***@neptune-tech.com> wrote:
The following program outputs False rather than True.
And indeed it should.
From the ECMA C# spec, section 14.5.4, Member Access:
(applicable sections only):
A member-access of the form E.I, where E is a primary-expression or a
predefined-type and I is an identifier, is evaluated and classified as
follows:
If E is a property access, indexer access, variable, or value, the type
of which is T, and a member lookup (§14.3) of I in T produces a match,
then E.I is evaluated and classified as follows:
If T is a class-type and I identifies an instance field of that class-
type:
[...]
Otherwise, if the field is readonly and the reference occurs outside an
instance constructor of the class in which the field is declared, then
the result is a value, namely the value of the field I in the object
referenced by E.
So, due to it being a read-only field, the result of the expression
c.Value is the value of c.Value, not a variable. Changing the data in
that value doesn't change the data in c.Value, as V is a value type.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too