🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Array properties in C# ?

#648
From: Craig K
Date: Wed, 01 Sep 2004 04:57
27 lines
1749 bytes
Hi,

I'm porting some Delphi code to C#.
I have a class defined like this :

  TParamsList = class(TList)
  private
    function GetAsInteger(i: Integer): Integer;
    function GetAsInt64(i: Integer): Int64;

    function GetExprType(i: Integer): TExprType;
    function GetParam(i: Integer): TExpToken;
  public
    destructor Destroy; override;
    property Param[i: Integer]: TExpToken read GetParam;
    property ExprType[i: Integer]: TExprType read GetExprType;

    property AsInteger[i: Integer]: Integer read GetAsInteger;
    property AsInt64[i: Integer]: Int64 read GetAsInt64;
  end;

What is the equivalent from this to C# ?
I tried to create an indexer, by I can't declare "this" as property more than once.
Isn't there any equivalent code ? I'd like to avoid an array for each property.

Regards,
Technical Details
Message-ID: <413556b2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,c22babec1f938d90,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Craig K" <craigkenisston@hotmail.com>
Sender: "Craig K" <craigkenisston@hotmail.com>
Reply-To: "Craig K" <craigkenisston@hotmail.com>
Subject: Array properties in C# ?
Newsgroups: borland.public.csharpbuilder.language.csharp
X-User-Info: 201.128.180.144     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <413556b2@newsgroups.borland.com>
Date: 31 Aug 2004 21:57:22 -0700
X-Trace: newsgroups.borland.com 1094014642 207.105.83.66 (31 Aug 2004 21:57:22 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail