πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #170

Re: Question about C# after reading 3rd party library docs

#170
From: Frederick C. Wilt
Date: Wed, 20 Sep 2006 18:54
144 lines
5229 bytes
Hi again,

OK heard from the author and he states that the library was written using 
VS2003/2005 and is a combination of C# code and VB.NET code.

So I am confused again.

Regards, Frederick C. Wilt

"Joanna Carter [TeamB]" <joanna@not.for.spam> wrote in message 
news:45118640$1@newsgroups.borland.com...
> "Frederick C. Wilt" <fcwilt@mindspring.com> a οΏ½crit dans le message de 
> news:
> 45116e80$1@newsgroups.borland.com...
>
> | >> [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.
>
> I think you will find that this is not a limitation of C#, but of the
> language that the third-party assembly was written in. Take the time to
> create your own small DLL in C# and try to use it from C#, you will find 
> no
> such problems.
>
> Have another look at the documentation that you cited before :
>
> | Note that when calling property read methods that require input 
> parameters
>
> At this point, I believe there should be a comma in the text, not after
> "C#".
>
> | using C#, "get_" must be appended to the property name.
>
> The correct English word is prepended, not appended; I think this text is
> written by a someone who has a poor command of English and that you need 
> to
> interpret it rather than read it :-)
>
> | This is an idiosyncrasy of the C# language
>
> This is just not true, full stop, period.
>
> | and is not a naming convention inconsistency within this API.
>
> Following on from mly last comment, this is also blatantly untrue.
>
> If you have to call get_SomePropertyName(), then this is a function call,
> not a property, the parentheses at the end indicate that this cannot be a
> property.
>
> My guess is that the language that this assembly was written in does not
> support the concept of properties, insisting instead on the use of getter
> and setter methods.
>
> Is there any indication of the original language of the assembly ? I may 
> be
> totally wrong, but I thought that Delphi for .NET properties had to have
> accessors named like this, but this shouldn't affect what is seen from
> outside of an assembly.
>
> Here is the IL for part of a class written in C# in an assembly that is 
> used
> from other assemblies
>
> .class public abstract auto ansi beforefieldinit MyType
>      extends object
> {
>      .property string Name
>      {
>            .get instance string Carter.Framework.MyType::get_Name()
>      }
>
> ...
>
>
> .method public hidebysig specialname instance string get_Name() cil 
> managed
> {
>      .maxstack 1
>      .locals init (
>            [0] string text1)
>      L_0000: nop
>      L_0001: ldarg.0
>      L_0002: ldfld [mscorlib]System.Reflection.PropertyInfo
> Carter.Framework.Property::info
>      L_0007: callvirt instance string
> [mscorlib]System.Reflection.MemberInfo::get_Name()
>      L_000c: stloc.0
>      L_000d: br.s L_000f
>      L_000f: ldloc.0
>      L_0010: ret
> }
>
> So you can see that the IL knows about properties and links the property 
> to
> a getter method.
>
> Here is the Delphi code for that.
>
> public property Name: string read get_Name;
>
> function Property.get_Name: string;
> begin
>      Result := self.info.Name
> end;
>
> ...and here is the C# code
>
> public string Name
> {
>      get
>      {
>            return this.info.Name;
>      }
> }
>
> ...which you can see doesn't have the concept of a separated method.
>
> But, much more telling is the MC++ code
>
> public: __property System::String __gc* get_Name()
> {
>      return this->info->Name;
> }
>
> My conclusion is that your DLL is written in Managed C++
>
> Joanna
>
> -- 
> Joanna Carter [TeamB]
> Consultant Software Engineer
>
> 
Technical Details
Message-ID: <45118e66$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.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
References: <4510c1fc$1@newsgroups.borland.com> <4510e002$1@newsgroups.borland.com> <45116e80$1@newsgroups.borland.com> <45118640$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> <45116e80$1@newsgroups.borland.com> <45118640$1@newsgroups.borland.com>
Subject: Re: Question about C# after reading 3rd party library docs
Date: Wed, 20 Sep 2006 14:54:22 -0400
Lines: 146
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: <45118e66$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158778470 70.177.164.151 (20 Sep 2006 11:54:30 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news4.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