🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

How can I create a static array of structure?

#133
From: A Nonymous
Date: Thu, 31 May 2007 15:37
26 lines
1750 bytes
I am attempting to convert a C++ application to C#.  In the application I 
use a static array of structures to maintain a device capabilities matrix.  
Basically I am communication with a series of devices across the internet.  
All of the devices are these same but have minor differences based on model 
and firmware revision.  To keep it strait, in the C++ app I defined a 
structure containing the variable parameters for a device.  Then I created 
a static array of this stricture which is populated with the appropriate 
parameters for the model.

struct TWidget
{
  int MemAvail;
  int MemOffset;
};

static TWidget Widget[2] =
{
  {0x100,0x200},
  {0x120,0x400}
};

In my app I can just refer to Widget[Model].MemAvail  which will give me 
the amount of available memory for any model.  When we release a new model, 
I just add a new layer to the array...

How can I convert it to C#?  So far I can find no syntax that works.
Technical Details
Message-ID: <Xns99416C2344551anonymoushotmailcom@207.105.83.66>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,d262dde1775b804b,start
X-Google-Attributes: gid1efe35,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: How can I create a static array of structure?
From: A Nonymous <anonymous@hotmail.com>
Message-ID: <Xns99416C2344551anonymoushotmailcom@207.105.83.66>
User-Agent: Xnews/5.04.25
NNTP-Posting-Host: 74.254.162.162
Date: 31 May 2007 08:37:48 -0700
X-Trace: newsgroups.borland.com 1180625868 74.254.162.162 (31 May 2007 08:37:48 -0700)
Lines: 26
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail