I guess my main question is, will this always work as long as I don't re-initialize (new byte[#]) the array that was passed as the parameter?
static unsafe decimal GetDecimal(byte[] ba)
{
decimal* decimal_PTR;
fixed (byte* byte_PTR = &ba[0])
{
decimal_PTR = ((decimal*)byte_PTR);
}
return *decimal_PTR;
}
I'm not sure how C# handles arrays in memory. I didn't even know they were managed types until about an hour ago. I just want to know if I pass in a decimal as a byte[], will it always return the correct value? Any other information you can provide is appreciated.