Click here to Skip to main content
15,917,538 members
Home / Discussions / C#
   

C#

 
GeneralRe: Performance: String.Length==0 or String == String.Empty Pin
Heath Stewart11-May-04 4:29
protectorHeath Stewart11-May-04 4:29 
GeneralConvert char* to string Pin
peraonline11-May-04 2:09
peraonline11-May-04 2:09 
GeneralRe: Convert char* to string Pin
bertcox11-May-04 3:26
bertcox11-May-04 3:26 
GeneralRe: Convert char* to string Pin
Judah Gabriel Himango11-May-04 3:49
sponsorJudah Gabriel Himango11-May-04 3:49 
GeneralRe: Convert char* to string Pin
peraonline11-May-04 20:32
peraonline11-May-04 20:32 
GeneralRe: Convert char* to string Pin
Heath Stewart12-May-04 2:55
protectorHeath Stewart12-May-04 2:55 
GeneralRe: Convert char* to string Pin
peraonline12-May-04 3:10
peraonline12-May-04 3:10 
GeneralRe: Convert char* to string Pin
Heath Stewart12-May-04 3:57
protectorHeath Stewart12-May-04 3:57 
A string is also a char*. The difference is how the character array (string) is allocated.

There are properties you can set using the MarshalAsAttribute that I mentioned earlier) that specify the maximum size (in characters, not bytes) or a parameter index that does the same within a struct (if one exists). Read the documentation for the MarshalAsAttribute in the .NET Framework SDK for more information. Trust me, my forté is unmanaged interop. I've never had to use a single unsafe context to P/Invoke anything from basic to complex structs and function calls. They're really only necessary when you need to boost performance of a block of code; for example, iterating through the bits of a bitmap - using an unsafe context is much faster.

You should also see the Marshal class, which includes methods that further prevent you from having to use an unsafe context (because it does it for you, like alloc'ing memory).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Convert char* to string Pin
peraonline12-May-04 4:03
peraonline12-May-04 4:03 
GeneralCharacter Encoding Pin
gUrM33T11-May-04 1:45
gUrM33T11-May-04 1:45 
GeneralRe: Character Encoding Pin
Mike Dimmick11-May-04 3:33
Mike Dimmick11-May-04 3:33 
GeneralRe: Character Encoding Pin
Paul Watson11-May-04 4:11
sitebuilderPaul Watson11-May-04 4:11 
GeneralRe: Character Encoding Pin
Heath Stewart11-May-04 4:25
protectorHeath Stewart11-May-04 4:25 
GeneralbeginInvoke() Pin
sreejith ss nair11-May-04 1:32
sreejith ss nair11-May-04 1:32 
GeneralRe: beginInvoke() Pin
Heath Stewart11-May-04 4:14
protectorHeath Stewart11-May-04 4:14 
GeneralRe: beginInvoke() Pin
Paul Watson11-May-04 4:14
sitebuilderPaul Watson11-May-04 4:14 
GeneralHTTP request,response Pin
dcronje11-May-04 1:05
dcronje11-May-04 1:05 
GeneralRe: HTTP request,response Pin
Heath Stewart11-May-04 4:05
protectorHeath Stewart11-May-04 4:05 
Generalhelp on wmi and registry Pin
chettu11-May-04 0:54
chettu11-May-04 0:54 
GeneralRe: help on wmi and registry Pin
Heath Stewart11-May-04 3:59
protectorHeath Stewart11-May-04 3:59 
GeneralRe: help on wmi and registry Pin
chettu11-May-04 20:18
chettu11-May-04 20:18 
GeneralRe: help on wmi and registry Pin
Heath Stewart12-May-04 2:52
protectorHeath Stewart12-May-04 2:52 
GeneralRe: help on wmi and registry Pin
chettu12-May-04 3:21
chettu12-May-04 3:21 
Generalblock the keyboard Pin
cristina_tudor11-May-04 0:36
cristina_tudor11-May-04 0:36 
GeneralRe: block the keyboard Pin
Corinna John11-May-04 0:50
Corinna John11-May-04 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.