Click here to Skip to main content
15,906,081 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert Given string to If statment Pin
Manfred Rudolf Bihy17-Dec-11 15:11
professionalManfred Rudolf Bihy17-Dec-11 15:11 
AnswerRe: Convert Given string to If statment Pin
AmitGajjar17-Dec-11 7:19
professionalAmitGajjar17-Dec-11 7:19 
Questionhelp Pin
kb.bolbol16-Dec-11 12:51
kb.bolbol16-Dec-11 12:51 
AnswerRe: help Pin
AspDotNetDev16-Dec-11 13:03
protectorAspDotNetDev16-Dec-11 13:03 
AnswerRe: help Pin
Not Active16-Dec-11 13:51
mentorNot Active16-Dec-11 13:51 
AnswerRe: help Pin
DaveyM6916-Dec-11 14:50
professionalDaveyM6916-Dec-11 14:50 
AnswerRe: help PinPopular
Luc Pattyn16-Dec-11 15:01
sitebuilderLuc Pattyn16-Dec-11 15:01 
GeneralRe: help Pin
BillWoodruff16-Dec-11 18:12
professionalBillWoodruff16-Dec-11 18:12 
AnswerRe: help Pin
Pete O'Hanlon16-Dec-11 23:38
mvePete O'Hanlon16-Dec-11 23:38 
AnswerRe: help Pin
#realJSOP17-Dec-11 3:04
professional#realJSOP17-Dec-11 3:04 
GeneralReason for my vote of 1 Pin
Manfred Rudolf Bihy17-Dec-11 15:21
professionalManfred Rudolf Bihy17-Dec-11 15:21 
GeneralRe: Reason for my vote of 1 PinPopular
#realJSOP18-Dec-11 0:57
professional#realJSOP18-Dec-11 0:57 
AnswerRe: help Pin
AmitGajjar17-Dec-11 7:22
professionalAmitGajjar17-Dec-11 7:22 
Questionunmanaged - returning arrays Pin
Mark H Bishop16-Dec-11 12:26
Mark H Bishop16-Dec-11 12:26 
AnswerRe: unmanaged - returning arrays Pin
Luc Pattyn16-Dec-11 15:08
sitebuilderLuc Pattyn16-Dec-11 15:08 
GeneralRe: unmanaged - returning arrays Pin
Mark H Bishop17-Dec-11 4:08
Mark H Bishop17-Dec-11 4:08 
GeneralRe: unmanaged - returning arrays Pin
Luc Pattyn17-Dec-11 4:22
sitebuilderLuc Pattyn17-Dec-11 4:22 
You're right, there's a typo in my article, nobody ever noticed, myself including. I will fix it.
int sum=SumArray(numbers, dim); is what it should be in automatic mode.
Thanks for pointing this out.

Your code is fine. One suggestion: whenever possible, also pass the length as a separate parameter, that way your native code can be confident about how much data it can safely read and/or write (automatic mode turns the array reference into a simple pointer, so all size info isn't passed on). That is what the dim parameter is doing in my example. As always, reading memory locations you're not supposed to read may cause an exception, writing beyond the boundaries most probably will cause an exception.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: unmanaged - returning arrays Pin
Mark H Bishop17-Dec-11 7:22
Mark H Bishop17-Dec-11 7:22 
AnswerRe: unmanaged - returning arrays Pin
Luc Pattyn17-Dec-11 7:40
sitebuilderLuc Pattyn17-Dec-11 7:40 
GeneralRe: unmanaged - returning arrays Pin
harold aptroot17-Dec-11 5:13
harold aptroot17-Dec-11 5:13 
GeneralRe: unmanaged - returning arrays Pin
Mark H Bishop17-Dec-11 7:16
Mark H Bishop17-Dec-11 7:16 
GeneralRe: unmanaged - returning arrays Pin
Mark H Bishop17-Dec-11 7:29
Mark H Bishop17-Dec-11 7:29 
QuestionCoolest way to do this string operation? Pin
SledgeHammer0116-Dec-11 11:23
SledgeHammer0116-Dec-11 11:23 
AnswerRe: Coolest way to do this string operation? Pin
PIEBALDconsult16-Dec-11 11:34
mvePIEBALDconsult16-Dec-11 11:34 
GeneralRe: Coolest way to do this string operation? Pin
SledgeHammer0116-Dec-11 11:44
SledgeHammer0116-Dec-11 11:44 

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.