469,601 Members | 2,328 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

How to build lookup table with an array as one of the elements?

Hi,

I need to build a BAUDOT lookup table for an encoder. I see to use a
char as the index 'A' or 'B' and get back an array of booleans (five
elements long).

Baudot['A'] = {00011}
Baudot['B'] = {11001}

Can someone give me a pointer on how to build this as a static lookup
table?

Do I want an array of arrays?

public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };

This isn't right because an A is not a bool.

Maybe an array of structures?

How do I initiale the structure boolean array?

Thanks,
John
Nov 15 '05 #1
3 2259
John <jo********@hotmail.com> wrote:
I need to build a BAUDOT lookup table for an encoder. I see to use a
char as the index 'A' or 'B' and get back an array of booleans (five
elements long).

Baudot['A'] = {00011}
Baudot['B'] = {11001}

Can someone give me a pointer on how to build this as a static lookup
table?


It sounds to me as if you don't want an array, you want a map - look at
Hashtable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

Hi John,

I think you can do something like this:

Hashtable ht=new Hashtable();
ht.Add('A',new byte[]{0,0,0,1,1});
ht.Add('B',new byte[]{1,1,0,0,1});
byte [] arr1=(byte[])ht['A'];
byte [] arr2=(byte[])ht['B'];

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: jo********@hotmail.com (John)
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: How to build lookup table with an array as one of the elements?
| Date: 27 Oct 2003 11:49:10 -0800
| Organization: http://groups.google.com
| Lines: 24
| Message-ID: <d8**************************@posting.google.com >
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067284150 20939 127.0.0.1 (27 Oct 2003
19:49:10 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Mon, 27 Oct 2003 19:49:10 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.google.com!no
t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:194480
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I need to build a BAUDOT lookup table for an encoder. I see to use a
| char as the index 'A' or 'B' and get back an array of booleans (five
| elements long).
|
| Baudot['A'] = {00011}
| Baudot['B'] = {11001}
|
| Can someone give me a pointer on how to build this as a static lookup
| table?
|
| Do I want an array of arrays?
|
| public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };
|
| This isn't right because an A is not a bool.
|
| Maybe an array of structures?
|
| How do I initiale the structure boolean array?
|
| Thanks,
| John
|

Nov 15 '05 #3
Thanks!

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:uN**************@cpmsftngxa06.phx.gbl...

Hi John,

I think you can do something like this:

Hashtable ht=new Hashtable();
ht.Add('A',new byte[]{0,0,0,1,1});
ht.Add('B',new byte[]{1,1,0,0,1});
byte [] arr1=(byte[])ht['A'];
byte [] arr2=(byte[])ht['B'];

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: jo********@hotmail.com (John)
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: How to build lookup table with an array as one of the elements?
| Date: 27 Oct 2003 11:49:10 -0800
| Organization: http://groups.google.com
| Lines: 24
| Message-ID: <d8**************************@posting.google.com >
| NNTP-Posting-Host: 192.25.240.225
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1067284150 20939 127.0.0.1 (27 Oct 2003
19:49:10 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Mon, 27 Oct 2003 19:49:10 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnew s1.google.com!no t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:194480 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi,
|
| I need to build a BAUDOT lookup table for an encoder. I see to use a
| char as the index 'A' or 'B' and get back an array of booleans (five
| elements long).
|
| Baudot['A'] = {00011}
| Baudot['B'] = {11001}
|
| Can someone give me a pointer on how to build this as a static lookup
| table?
|
| Do I want an array of arrays?
|
| public static bool [][] = {'A', {0, 0, 0, 1, 1, 1} };
|
| This isn't right because an A is not a bool.
|
| Maybe an array of structures?
|
| How do I initiale the structure boolean array?
|
| Thanks,
| John
|

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Sims | last post: by
6 posts views Thread by Neal D. Becker | last post: by
11 posts views Thread by John Collyer | last post: by
10 posts views Thread by Douglas Buchanan | last post: by
2 posts views Thread by Joe Reed | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.