You can find documentation here:
http://msdn2.microsoft.com/en-us/library/xxda45fy.aspx
According to this document, the class must have a default property that
accepts a String as an argument. So it won't work with integers.
I believe this is around from VB6, actually, and that is why it is in .NET.
It's a compatibility issue, instead of MS thinking this would be a nice
feature to have around.
"Ben R." <be**@newsgroup.nospam> wrote in message
news:F9**********************************@microsof t.com...
Very interesting. Is there any documentation out there on this? Must the
accessor be a string? You're using "goo" with quotes and then with the !,
it's not with quotes so I'm assuming this is implied. Does this mean you
couldn't use, say, an integer accessor?
"Herfried K. Wagner [MVP]" wrote:
"Ben R." <be**@newsgroup.nospam> schrieb: >I stumbled across an older post:
>
> http://msdn.microsoft.com/newsgroups...xp=&sloc=en-us
>
> Which uses the ! in a way I haven't seen before and I'm having trouble
> figuring out what it's doing there. The line is:
>
> =CDate(Parameters!StartDate.Value).AddMonths(-1).ToString("MMMM")
>
> The only thing I've found on ! is that it indicates:
> "Appending the identifier type character ! to any identifier forces it
> to
> Single." (From .NET 1.1 Framework docs) but that is for vb.net and not
> c#,
> so
> I don't think it would apply.
'!' can be used with default properties to access a certain item.
\\\
Dim c As New Collection
c.Add("Bla", "Goo")
' Semantically equivalent lines.
MsgBox(c!Goo)
MsgBox(c("Goo"))
MsgBox(c.Item("Goo"))
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>