What's the difference between new String(char*)
and Marshal.PtrToStringUni(IntPtr)
, aside from the obvious fact that one takes char*
and one takes IntPtr
? When should I use which?
I remember getting a really random access violation that took an enormous amount of time to track down about a couple of years ago when using the constructor, and it went away when I used the PtrToStringUni
. Maybe that wasn't the real cause, I don't know, but it seemed to be.
I never figured out what the difference was, though. Any ideas?
Edit:
This question has the answer to most of my question; however: is there any explanation for my access violation, or was it because of something else?