List.AddRange inline declaration

Posted by AJ on Stack Overflow See other posts from Stack Overflow or by AJ
Published on 2010-03-26T06:33:59Z Indexed on 2010/03/26 6:43 UTC
Read the original article Hit count: 156

Filed under:
|
|

Hello,

This may seem an easy question, but not to me, also a search has led to nothing. Up until now the only .net programming I have done is with Delphi Prism. With Prism I can do things like:

var l := new List<String>(['A','B','C']);

or

var l := new List<String>;
l.AddRange(['A','B','C'];

but can I do a similar thing in C#, or do I have to do it like:

var a = new String[] {"A","B","C"};
var l = new List<String>(a);

Thanks,

AJ

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET