Best way to represent Bit Arrays in C#??
Posted
by divinci
on Stack Overflow
See other posts from Stack Overflow
or by divinci
Published on 2010-04-19T16:59:01Z
Indexed on
2010/04/19
17:03 UTC
Read the original article
Hit count: 480
Hi all,
I am currently building a DHCPMessage class in c#.
RFC is available here : http://www.faqs.org/rfcs/rfc2131.html
Pseudo
public object DHCPMessage
{
bool[8] op;
bool[8] htype;
bool[8] hlen;
bool[8] hops;
bool[32] xid;
bool[16] secs;
bool[16] flags;
bool[32] ciaddr;
bool[32] yiaddr;
bool[32] siaddr;
bool[32] giaddr;
bool[128] chaddr;
bool[512] sname;
bool[1024] file;
bool[] options;
}
If we imagine that each field is a fixed length bit array, what is :
- The most versitile
- Best practice
way of representing this as a class???
OR.. how would you write this? :)
© Stack Overflow or respective owner