extract some parts of a string array in c# -
i have string array 31 strings, have extract string 3rd position 27th position , pass part string array function. how accomplish in c#?
you can use array.copy(array, int32, array, int32, int32) overload ;
copies range of elements array starting @ specified source index , pastes them array starting @ specified destination index.
array.copy(source, 2, destination, 0, 25); but create new array. can use linq istead skip , take methods like;
var destination = source.skip(2).take(25).toarray(); i assume want 27th position also, that's why used 25 length (or count) in both example. if don't want 27th position, need change 25 24 in both case.
Comments
Post a Comment