asp.net - set control ID using string.concat -


i've code in c#, in there many lines of code id of control set string.concat. ex:

private genericcontrol ctrlgrid; genericcontrol = page.loadcontrol(obj); genericcontrol.id = string.concat("gridcontrol"); 

can there specific reasons setting id using string.concat? can there performance hit associated this?

i think should use just:

genericcontrol.id = "gridcontrol"; 

edit: take @ string.concat() method used when passing 1 parameter:

public static string concat(params string[] values) {     if (values == null)     {         throw new argumentnullexception("values");     }     int totallength = 0;     string[] strarray = new string[values.length];     (int = 0; < values.length; i++)     {         string str = values[i];         strarray[i] = (str == null) ? empty : str;         totallength += strarray[i].length;         if (totallength < 0)         {             throw new outofmemoryexception();         }     }     return concatarray(strarray, totallength); } 

so yes, has performance overhead , better use string.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -