πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#169
From: Frederick C. Wilt
Date: Wed, 20 Sep 2006 18:44
152 lines
5489 bytes
Hi,

So when the error message says "not supported by the language" it is 
referring to the language used for writing the 3rd party assembly and NOT 
the C# language used for my test program?

That seems reasonable given your explanation.

Of course if it was written in managed C++ and is aimed at .NET users I have 
to wonder why. All of the sample programs that came with the library are 
written in C# or VB.NET.

So a message to the author seems to be in order.

Thanks for all the help, 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: <45118c25$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!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:44:45 -0400
Lines: 154
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: <45118c25$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158777893 70.177.164.151 (20 Sep 2006 11:44:53 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail