c# - Dump GUID structure? -
the guid construction apparently looks this:
typedef struct _guid { dword data1; word data2; word data3; byte data4[8]; } guid; how can see dword/word/byte values are? i'm trying spit them out using c# don't know how print them.
i don't care if done in c, c# or whatever language, think microsoft uses same construction under hood. need able see construction can debug php script needs read these things. don't have access visual studio right (i'm on ubuntu).
how "too broad"? i'll create more specific: given guid hex representation e20a9380-fd55-bca5-9037-451c9d86e949 , binary representation new byte[]{0x80,0x93,0x0a,0xe2,0x55,0xfd,0xa5,0xbc,0x90,0x37,0x45,0x1c,0x9d,0x86,0xe9,0x49} know of bytes correspond data1, data2 , data3 , numeric values are.
the hyperlink above shows attempt:
public static void main() { var guid = new guid("e20a9380-fd55-bca5-9037-451c9d86e949"); console.writeline(guid); printobj(guid); } public static void printobj(object obj) { foreach(propertydescriptor descriptor in typedescriptor.getproperties(obj)) { string name=descriptor.name; object value=descriptor.getvalue(obj); console.writeline("{0}={1}",name,value); } } but doesn't print anything. aren't readable properties guess.
if want utilize c# on ubuntu, xamarin.
in c#, guid structre exposes tobytearray print byte byte.
foreach(var b in id.tobytearray()) console.writeline("{0:x2}", b); or trnalsation using bitconverter class each part seperately
var bytes = id.tobytearray(); console.writeline("data1: {0:x8}", bitconverter.toint32(bytes, 0)); console.writeline("data2: {0:x4}", bitconverter.toint16(bytes, 4)); console.writeline("data3: {0:x4}", bitconverter.toint16(bytes, 6)); console.writeline("data4: {0:x16}", bitconverter.toint64(bytes, 8)); c# php c
No comments:
Post a Comment