c# - How do I return lengths of string in an array? -
i have array of strings , want output of length array.
string[]myarray = {"stringone", "stringtwo", "stringthree"};
i have tried doing
foreach(thing in myarray){ if(thing.length<10){ stuff } @output
but doesnt work. going wrong? i'm using c# in asp.net.
many thanks.
you need specify thing
string
or var
.
also, need capitalize length.
public void mctester() { string[] myarray = { "stringone", "stringtwo", "stringthree" }; foreach (string thing in myarray) { if (thing.length < 10) { //do stuff } } }
c# asp.net arrays string
No comments:
Post a Comment