This short post will kick off a series covering some of the new features in C#.
One small but much requested feature is the ability to use any kind of collection for params. Previously you had to pass in an array:
public void MyMethod(int firstParam, params string[] otherParams)
{
foreach (var param in otherParams)
{
Console.WriteLine(param);
}
}
But now you can pass in any kind of collection,
public void MyMethod(int firstParam, params List<string> otherParams)
{
foreach (var param in otherParams)
{
Console.WriteLine(param);
}
}
This can save a great deal of fussing, converting your collection to an array and back.
Please note that this is a preview feature. Fortunately, Intellisense will convert your project for you. When you put this in you’ll get the dreaded red squiggly. Click on the light bulb and let it convert your project. Hey! Presto! it works.
We’ll look at a few bigger features in coming blog posts.
Itโs really a great and useful piece of info. Iโm glad that you shared this useful information with us. Please keep us informed like this. Thank you for sharing.
Este site é realmente fantástico. Sempre que acesso eu encontro novidades Você também vai querer acessar o nosso site e saber mais detalhes! Conteúdo exclusivo. Venha descobrir mais agora! ๐
907017 121047Thanks for helping out, superb information . 79502
Fantastic site. Lots of useful information here. Iโm sending it to several friends ans also sharing in delicious. And obviously, thanks for your sweat!
Great site. Lots of helpful info here. I?ยฆm sending it to some buddies ans also sharing in delicious. And obviously, thanks to your sweat!
F*ckinโ remarkable things here. Iโm very happy to look your article. Thank you a lot and i am looking forward to contact you. Will you kindly drop me a mail?
Wow! This could be one particular of the most beneficial blogs We’ve ever arrive across on this subject. Actually Great. I am also an expert in this topic so I can understand your effort.
https://www.youtube.com/channel/UCyt2dGrKTf9KpBk1jdUl3oA
https://www.youtube.com/channel/UCyt2dGrKTf9KpBk1jdUl3oA
https://www.youtube.com/channel/UCyt2dGrKTf9KpBk1jdUl3oA