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

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -