First part:
I have a string...
string sTest = "This is my test string";
How can I (manually, without code) determine the SizeOf the string? What should it end up being? How do you get that size?
Second Part:
I have a class...
[StructLayout(LayoutKind.Sequential)]
public class TestStruct
{
public string Test;
}
I use it...
TestStruct oTest = new TestStruct();
oTest.Test = "This is my test string";
Are there any differences in size from the first part to the second part?
Update:
The point of this is to use the size as a way to create a memory map file.
long lMapSize = System.Runtime.InteropServices.Marshal.SizeOf(oTest);
mmf = MemoryMappedFile.CreateOrOpen("testmap", lMapSize);
Just thought it was worth noting. Currently lMapSize = 4. Which confuses the ... out of me! Thanks everyone!