Re: Application Organization
You can do fixed size arrays in C# using fixed keyword in unsafe code,
Code:
unsafe{
public struct User{
public fixed char[32] Name;
public fixed char[64] Email;
public byte AccessLevel;
};
}
Re: Application Organization
Quote:
Originally Posted by
Krishnaa
You can do fixed size arrays in C# using fixed keyword in unsafe code,
Code:
unsafe{
public struct User{
public fixed char[32] Name;
public fixed char[64] Email;
public byte AccessLevel;
};
}
I would also add that the "fixed" keyword will pin the object in memory and prevent the GC from relocating it when it tidies the heap space.
Re: Application Organization
I am new to C# as well so chances are high that I am wrong... but can't you do something like:
Code:
char[] Name = new char[32];
?
Re: Application Organization
Quote:
Originally Posted by
TryingToC#
I am new to C# as well so chances are high that I am wrong... but can't you do something like:
Code:
char[] Name = new char[32];
?
No, but you can do this:
Code:
struct Foo
{
char[ ] c;
public foo( int len )
{
c = new char[ len ];
}
}