Generate a string in C# using Linq

Gopesh9
Posted by Gopesh9 under C# category on | Points: 40 | Views : 1046
Here's an example of generating string using Linq

string str = new string(Enumerable.Range(0, N).Select(a => (char)('A' + a % 3)).ToArray());


Just print "str" to get the desired result...

Comments or Responses

Login to post response