Home > Software design >  With Char for loop
With Char for loop

Time:07-26

My question; I want two different char value from user. For example BlockStart=a and BlockFinish=d after then I want doing for loop 'd' to 'a' I did BlockStart and BlockFinish properties char type and I prepared for loop: { for (char i = dto.BlockStartAlphabetical; i <= dto.BlockFinishalphabetical; i ) {} }

but this expression don't come in for loop. What can I do?

CodePudding user response:

Well you can use linq in a way that helps you to build an array of characters like below :

var start = 'a';
var end = 'd';
var result = Enumerable.Range(0,end-start 1).Select(ix=> (char)(start ix)).ToArray();

// result = [a,b,c,d]

Fiddle

CodePudding user response:

Client entry values 'a' end 'd' but I catching look photoenter image description here

  • Related