Modern C# – Part 1

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.

Unknown's avatar

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. Liberty is a Senior AI Engineer at the University of Pittsburgh Medical Center, and was a Team Lead and Senior Software Engineer for various corporations, a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a 21 year Microsoft MVP.
This entry was posted in C#, C# 12, Essentials. Bookmark the permalink.

1,500 Responses to Modern C# – Part 1

  1. situs slot's avatar situs slot says:

    I have not checked in here for a while as I thought it was getting boring, but the last several posts are great quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂

  2. this link's avatar this link says:

    I’m extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you customize it yourself? Either way keep up the excellent quality writing, it’s rare to see a nice blog like this one these days..

  3. audifort buy's avatar audifort buy says:

    I am perpetually thought about this, regards for putting up.

  4. click's avatar click says:

    Wohh precisely what I was searching for, thanks for putting up.

  5. ceritoto's avatar ceritoto says:

    I like this blog very much, Its a very nice place to read and receive information.

  6. visit's avatar visit says:

    I couldn’t resist commenting

  7. ceritoto's avatar ceritoto says:

    I have not checked in here for some time as I thought it was getting boring, but the last few posts are good quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂

  8. indofilm's avatar indofilm says:

    Good day! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Thank you!

  9. slot gacor's avatar slot gacor says:

    As I site possessor I believe the content matter here is rattling great , appreciate it for your efforts. You should keep it up forever! Best of luck.

  10. pestoto's avatar pestoto says:

    Thanks for every other informative site. Where else may I get that type of information written in such an ideal manner? I have a venture that I’m simply now working on, and I have been at the look out for such information.

  11. You made some fine points there. I did a search on the subject matter and found a good number of folks will go along with with your blog.

  12. situs slot's avatar situs slot says:

    hello!,I like your writing so much! share we communicate more about your post on AOL? I require an expert on this area to solve my problem. Maybe that’s you! Looking forward to see you.

  13. you might have a great blog here! would you like to make some invite posts on my weblog?

  14. pestoto's avatar pestoto says:

    I am really enjoying the theme/design of your website. Do you ever run into any browser compatibility issues? A number of my blog visitors have complained about my website not working correctly in Explorer but looks great in Firefox. Do you have any suggestions to help fix this issue?

  15. What i do not understood is if truth be told how you’re not actually much more smartly-liked than you may be now. You are very intelligent. You know therefore considerably when it comes to this matter, produced me individually consider it from so many various angles. Its like women and men are not interested unless it is one thing to accomplish with Lady gaga! Your personal stuffs outstanding. At all times maintain it up!

  16. You actually make it appear so easy with your presentation however I in finding this matter to be really one thing that I feel I might never understand. It seems too complicated and extremely broad for me. I’m looking ahead in your next put up, I’ll attempt to get the dangle of it!

  17. tv assinada's avatar tv assinada says:

    Wonderful web site. Lots of useful info here. I’m sending it to some friends ans also sharing in delicious. And of course, thanks for your sweat!

  18. nextogel's avatar nextogel says:

    I was suggested this website by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks!

  19. I was very pleased to find this net-site.I wished to thanks to your time for this excellent read!! I definitely enjoying every little bit of it and I’ve you bookmarked to check out new stuff you blog post.

  20. malware's avatar malware says:

    Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been amazed me. Thanks, quite nice article.

  21. nextogel's avatar nextogel says:

    Howdy! This is my 1st comment here so I just wanted to give a quick shout out and say I really enjoy reading your posts. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thanks a ton!

  22. 外匯 圖's avatar 外匯 圖 says:

    Hello my family member! I want to say that this post is awesome, great written and include almost all vital infos. I?¦d like to look more posts like this .

  23. malware's avatar malware says:

    Some truly nice and useful information on this web site, as well I think the design has fantastic features.

  24. malware's avatar malware says:

    Magnificent site. Plenty of useful information here. I?¦m sending it to some pals ans additionally sharing in delicious. And naturally, thanks for your effort!

  25. nextogel's avatar nextogel says:

    Hi, Neat post. There’s a problem with your web site in internet explorer, would check this… IE still is the market leader and a big portion of people will miss your magnificent writing due to this problem.

  26. Malware's avatar Malware says:

    As I website owner I think the content here is very excellent, thankyou for your efforts.

  27. nextogel's avatar nextogel says:

    Enjoyed reading through this, very good stuff, thanks.

  28. nonton film's avatar nonton film says:

    After I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get 4 emails with the same comment. Is there any means you may take away me from that service? Thanks!

  29. kopitogel's avatar kopitogel says:

    Unquestionably believe that that you stated. Your favorite justification appeared to be at the web the easiest factor to remember of. I say to you, I definitely get irked while other people think about concerns that they plainly don’t recognize about. You controlled to hit the nail upon the top as neatly as defined out the entire thing with no need side effect , folks could take a signal. Will probably be again to get more. Thanks

  30. Dead written written content, regards for selective information.

  31. kopitogel's avatar kopitogel says:

    I was studying some of your posts on this internet site and I believe this site is very informative! Continue posting.

  32. kopitogel's avatar kopitogel says:

    I think this is among the most vital information for me. And i am glad reading your article. But wanna remark on some general things, The website style is perfect, the articles is really great : D. Good job, cheers

  33. kopitogel's avatar kopitogel says:

    Wohh precisely what I was looking for, thanks for posting.

  34. I got what you intend,saved to fav, very decent website .

  35. Its great as your other blog posts : D, regards for putting up. “The squeaking wheel doesn’t always get the grease. Sometimes it gets replaced.” by Vic Gold.

  36. I have been reading out a few of your stories and i can state pretty good stuff. I will surely bookmark your site.

  37. An interesting dialogue is value comment. I think that you need to write more on this topic, it may not be a taboo subject however generally individuals are not sufficient to talk on such topics. To the next. Cheers

  38. Hello there I am so happy I found your website, I really found you by accident, while I was looking on Yahoo for something else, Regardless I am here now and would just like to say thanks for a remarkable post and a all round interesting blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read much more, Please do keep up the fantastic work.

  39. You actually make it seem really easy along with your presentation but I find this matter to be really something which I believe I would by no means understand. It seems too complex and very extensive for me. I am having a look forward in your next post, I’ll try to get the grasp of it!

  40. I think this site contains some real fantastic information for everyone :D. “Nothing surely is so disgraceful to society and to individuals as unmeaning wastefulness.” by Count Benjamin Thompson Rumford.

  41. PH22's avatar PH22 says:

    Lovely just what I was looking for.Thanks to the author for taking his clock time on this one.

  42. vduhhhbqi's avatar vduhhhbqi says:

    Cygnus 2: Spaß und attraktiv für Spieler. Das Casino ist von der Malta Gaming Authority lizenziert und reguliert und verfügt über eine Zertifizierung von eCOGRA, die als Hintergrund für die reichen Juwelen und Meerestiere in ihren Pastelltönen dienen. Dazu gehören beispielsweise die Überprüfung der Zufallszahlengeneratoren, unterwegs zu spielen und jederzeit frei zu sein. Einige der beliebtesten Arten von Spielautomaten sind Video-Spielautomaten, was viel bequemer ist und von vielen gegenüber dem Spielen in physischen Casinos bevorzugt wird. Sie müssen den Inhalt von reCAPTCHA laden, um das Formular abzuschicken. Bitte beachten Sie, dass dabei Daten mit Drittanbietern ausgetauscht werden. Starburst von NetEnt ist ein weiteres beliebtes Online-Slot-Spiel, nur eine Freispielrunde. Man kann Münzen bis zu 10 für jeden auswählen und Sie können den Münzwert auswählen, aber diese Winterausgabe ist vollgepackt mit nicht einer.
    https://fancypad.techinc.nl/s/3Yv2db3ho
    Bei Bwin Online sind die Einsatz-Limits ganz klar geregelt. Laut dem deutschem Glücksspielstaatsvertrag darfst du pro Spielrunde nicht mehr als 1 € setzen. Diese Vorgabe ist verpflichtend und gilt für alle Slots in der Bwin Online Spielothek. So soll sichergestellt werden, dass du verantwortungsvoll spielst und jederzeit den Überblick über deine Einsätze behältst. Cygnus 2 verfügt über eine moderne Technikarchitektur, folglich ist der Slot responsive. Das bedeutet für Euch, dass das gewählte Endgerät für das Spielvergnügen – zumindest was die Darstellung anbelangt – unerheblich ist. Denn das responsive Design sorgt dafür, dass sich die Darstellung automatisch an die Bildschirmgröße anpasst. Folglich macht auch das mobile Spiel, auf Tablet oder Smartphone, Spaß.

  43. Hiya, I’m really glad I’ve found this information. Today bloggers publish just about gossips and net and this is really irritating. A good blog with exciting content, that’s what I need. Thanks for keeping this site, I will be visiting it. Do you do newsletters? Can’t find it.

  44. ojwins's avatar ojwins says:

    Woh I enjoy your blog posts, bookmarked! .

  45. olxtoto's avatar olxtoto says:

    A lot of thanks for all your labor on this website. My mother really likes conducting investigation and it’s really obvious why. A number of us hear all relating to the lively form you produce sensible solutions via this website and in addition increase response from visitors about this point so our princess is certainly understanding a great deal. Have fun with the rest of the new year. You’re the one carrying out a fabulous job.

  46. Hi there! I’m at work browsing your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the outstanding work!

  47. I have been exploring for a little for any high-quality articles or weblog posts in this kind of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this info So i?¦m glad to exhibit that I’ve an incredibly good uncanny feeling I came upon exactly what I needed. I such a lot for sure will make certain to don?¦t put out of your mind this site and give it a look on a continuing basis.

  48. read more's avatar read more says:

    Magnificent website. Lots of useful info here. I am sending it to a few pals ans also sharing in delicious. And of course, thank you to your effort!

  49. raja botak's avatar raja botak says:

    I just couldn’t leave your website prior to suggesting that I really enjoyed the usual information a person provide in your visitors? Is going to be back often in order to check out new posts

  50. komik dewasa's avatar komik dewasa says:

    I was curious if you ever considered changing the page layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

Comments are closed.