Article View: borland.public.csharpbuilder.language.csharp
Article #167Re: Question about C# after reading 3rd party library docs
From: Frederick C. Wilt
Date: Wed, 20 Sep 2006 16:38
Date: Wed, 20 Sep 2006 16:38
94 lines
3635 bytes
3635 bytes
Hi,
Thanks for the feedback.
I verified that if I try to read from the property directly I get the
following error message (I have truncated the non-essential parts of the
message and changed the name of the property to a generic name):
>> [C# Error] WinForm.cs(260): Property, indexer, or event
>> 'SomePropertyName' is not supported by the language; try directly calling
>> accessor method...
Sure enough if I call get_SomePropertyName() with the appropriate parameters
everything is just fine.
I just think its rather odd that a new language like C# would not handle
properties of all sorts given that properties are not a new concept.
Regards, Frederick C. Wilt
"Joanna Carter [TeamB]" <joanna@not.for.spam> wrote in message
news:4510e002$1@newsgroups.borland.com...
> "Frederick C. Wilt" <fcwilt@mindspring.com> a οΏ½crit dans le message de
> news:
> 4510c1fc$1@newsgroups.borland.com...
>
> | I am new to C# and .NET so bear with me if I don't use the correct
> terms.
> |
> | I was writing a C# test app (in BDS2006) using this 3rd party library in
> a
> | .NET DLL. The documentation stated:
> |
> | ---------------------------------------
> | Note that when calling property read methods that require input
> parameters
> | using C#, "get_" must be appended to the property name. This is an
> | idiosyncrasy of the C# language and is not a naming convention
> inconsistency
> | within this API.
> |
> | ---------------------------------------
> |
> | It seems to be the case and I was wondering why. Seems kind of odd to
> have
> | this requirement.
>
> ??????????????????!!!!!!!!!!!!!!!!
>
> Interesting :-) I have been using C# for some time now and have never come
> across any such convention.
>
> The normal property declaration is :
>
> class Thing
> {
> private string name;
>
> public string Name
> {
> get { return name; }
> set { name = value; }
> }
> }
>
> However, the quote that you make says something about read methods that
> require input parameters; the only thing I can see that satisifies that
> would be an indexer (array property) :
>
> class Thing
> {
> private Dictionary<string, Stuff> stuffList;
>
> public Stuff this[string index]
> {
> get { return stuffList[index]; }
> }
> }
>
> But in no case that I know of would you ever call the accessor method,
> which
> does get compiled to a hidden method called something like get_Stuff.
>
> Do the docs give any examples of what they are talking about ?
>
> Joanna
>
> --
> Joanna Carter [TeamB]
> Consultant Software Engineer
>
>
Technical Details
Message-ID:
<45116e80$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4510c1fc$1@newsgroups.borland.com> <4510e002$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,f0e0371ea8ed4a27 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII From: "Frederick C. Wilt" <fcwilt@mindspring.com> Newsgroups: borland.public.csharpbuilder.language.csharp References: <4510c1fc$1@newsgroups.borland.com> <4510e002$1@newsgroups.borland.com> Subject: Re: Question about C# after reading 3rd party library docs Date: Wed, 20 Sep 2006 12:38:16 -0400 Lines: 96 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 NNTP-Posting-Host: 70.177.164.151 Message-ID: <45116e80$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1158770304 70.177.164.151 (20 Sep 2006 09:38:24 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail