in c#, how can i build up array from A to ZZ that is similar to the way that excel orders columns

后端 未结 10 1009
情深已故
情深已故 2020-12-18 00:48

i am looking for code that can generate an array where the first item is A, then B, then C . . .after Z i

10条回答
  •  攒了一身酷
    2020-12-18 01:34

    var q = Enumerable.Range(Convert.ToInt32('A'),26).Select( x => Convert.ToChar(x) );
    var result = (
      q.Select( x => x.ToString() )
       .Concat( 
          q.SelectMany(
            x => q.Select( y => x.ToString() + y.ToString() )
          )
       )
    );
    

提交回复
热议问题