Click here to Skip to main content
15,909,091 members
Home / Discussions / C#
   

C#

 
GeneralRe: Overloading + operator Pin
PIEBALDconsult29-Nov-07 8:21
mvePIEBALDconsult29-Nov-07 8:21 
GeneralRe: Overloading + operator Pin
Luc Pattyn29-Nov-07 8:28
sitebuilderLuc Pattyn29-Nov-07 8:28 
GeneralRe: Overloading + operator Pin
PIEBALDconsult29-Nov-07 14:29
mvePIEBALDconsult29-Nov-07 14:29 
GeneralRe: Overloading + operator Pin
Luc Pattyn29-Nov-07 14:38
sitebuilderLuc Pattyn29-Nov-07 14:38 
GeneralRe: Overloading + operator Pin
PIEBALDconsult29-Nov-07 15:02
mvePIEBALDconsult29-Nov-07 15:02 
GeneralRe: Overloading + operator Pin
Luc Pattyn29-Nov-07 15:25
sitebuilderLuc Pattyn29-Nov-07 15:25 
GeneralRe: Overloading + operator Pin
PIEBALDconsult29-Nov-07 17:49
mvePIEBALDconsult29-Nov-07 17:49 
GeneralRe: Overloading + operator Pin
Luc Pattyn29-Nov-07 23:32
sitebuilderLuc Pattyn29-Nov-07 23:32 
Hi PIEBALD,

I wrote mine in the early days of .NET when I was not yet aware of the Array.CopyTo method;
after todays rework it deals with null arguments, like so:

public static string[] Concat(string[] sa1, string[] sa2) {
    int len1=0;
    if (sa1!=null) len1=sa1.Length;
    int len2=0;
    if (sa2!=null) len2=sa2.Length;
    string[] sb=new string[len1+len2];
    if(sa1!=null) sa1.CopyTo(sb, 0);         // throws ArgumentException ...
    if(sa2!=null) sa2.CopyTo(sb, len1);   // ... when rank isn't 1
    return sb;
}


so I got rid of the for loops...

Smile | :)



Luc Pattyn [Forum Guidelines] [My Articles]


this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets


GeneralRe: Overloading + operator Pin
PIEBALDconsult30-Nov-07 3:50
mvePIEBALDconsult30-Nov-07 3:50 
GeneralRe: Overloading + operator Pin
Luc Pattyn30-Nov-07 4:56
sitebuilderLuc Pattyn30-Nov-07 4:56 
GeneralRe: Overloading + operator Pin
PIEBALDconsult1-Dec-07 17:40
mvePIEBALDconsult1-Dec-07 17:40 
GeneralRe: Overloading + operator Pin
PIEBALDconsult30-Nov-07 4:28
mvePIEBALDconsult30-Nov-07 4:28 
GeneralRe: Overloading + operator Pin
Luc Pattyn30-Nov-07 4:47
sitebuilderLuc Pattyn30-Nov-07 4:47 
QuestionError-Object reference not set to an instance of an object Pin
T4AMD29-Nov-07 7:30
T4AMD29-Nov-07 7:30 
AnswerRe: Error-Object reference not set to an instance of an object Pin
Alaric_29-Nov-07 8:19
professionalAlaric_29-Nov-07 8:19 
QuestionRe: Error-Object reference not set to an instance of an object Pin
T4AMD29-Nov-07 8:33
T4AMD29-Nov-07 8:33 
AnswerRe: Error-Object reference not set to an instance of an object Pin
Luc Pattyn29-Nov-07 8:46
sitebuilderLuc Pattyn29-Nov-07 8:46 
GeneralRe: Error-Object reference not set to an instance of an object Pin
T4AMD29-Nov-07 8:55
T4AMD29-Nov-07 8:55 
Questionremoving comments from xml strings Pin
AndrusM29-Nov-07 7:29
AndrusM29-Nov-07 7:29 
AnswerRe: removing comments from xml strings Pin
Dave Kreskowiak29-Nov-07 9:27
mveDave Kreskowiak29-Nov-07 9:27 
GeneralRe: removing comments from xml strings Pin
AndrusM29-Nov-07 22:13
AndrusM29-Nov-07 22:13 
GeneralRe: removing comments from xml strings Pin
Dave Kreskowiak30-Nov-07 2:32
mveDave Kreskowiak30-Nov-07 2:32 
GeneralRe: removing comments from xml strings Pin
AndrusM30-Nov-07 3:02
AndrusM30-Nov-07 3:02 
GeneralRe: removing comments from xml strings Pin
Dave Kreskowiak30-Nov-07 16:12
mveDave Kreskowiak30-Nov-07 16:12 
GeneralRe: removing comments from xml strings Pin
AndrusM1-Dec-07 6:32
AndrusM1-Dec-07 6:32 

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.