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. olxtoto's avatar olxtoto says:

    certainly like your web-site however you have to check the spelling on quite a few of your posts. A number of them are rife with spelling problems and I in finding it very troublesome to tell the reality nevertheless I¦ll surely come again again.

  2. I have recently started a blog, the information you offer on this web site has helped me greatly. Thanks for all of your time & work.

  3. olxtoto's avatar olxtoto says:

    Hey There. I found your blog using msn. This is a really well written article. I’ll make sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll definitely comeback.

  4. olxtoto's avatar olxtoto says:

    There is obviously a bunch to realize about this. I suppose you made certain nice points in features also.

  5. slot 5000's avatar slot 5000 says:

    Good day! I simply wish to give a huge thumbs up for the great info you may have right here on this post. I shall be coming again to your weblog for extra soon.

  6. slot gacor's avatar slot gacor says:

    After all, what a great site and informative posts, I will upload inbound link – bookmark this web site? Regards, Reader.

  7. Very interesting points you have observed, regards for putting up. “Ignorance, the root and the stem of every evil.” by Plato.

  8. I think this site has some rattling excellent information for everyone. “I have learned to use the word ‘impossible’ with the greatest caution.” by Wernher von Braun.

  9. Perfect piece of work you have done, this site is really cool with fantastic information.

  10. You should take part in a contest for one of the best blogs on the web. I will recommend this site!

  11. angka togel's avatar angka togel says:

    Appreciating the commitment you put into your site and detailed information you provide. It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed information. Wonderful read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  12. dolantoto88's avatar dolantoto88 says:

    I really appreciate this post. I¦ve been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thanks again

  13. What¦s Happening i am new to this, I stumbled upon this I’ve found It absolutely useful and it has helped me out loads. I am hoping to contribute & help other customers like its helped me. Great job.

  14. live macau's avatar live macau says:

    I dugg some of you post as I cerebrated they were extremely helpful extremely helpful

  15. dolantoto's avatar dolantoto says:

    Can I simply say what a reduction to search out somebody who actually knows what theyre talking about on the internet. You positively know the right way to convey an issue to gentle and make it important. Extra individuals have to read this and perceive this facet of the story. I cant believe youre no more in style because you definitely have the gift.

  16. Some truly nice stuff on this internet site, I enjoy it.

  17. pg slot's avatar pg slot says:

    I just could not leave your site prior to suggesting that I extremely loved the usual info a person supply to your guests? Is gonna be back often to investigate cross-check new posts

  18. kakahoki's avatar kakahoki says:

    Hi there just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Firefox. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let you know. The style and design look great though! Hope you get the problem fixed soon. Thanks

  19. Good info. Lucky me I reach on your website by accident, I bookmarked it.

  20. bandar macau's avatar bandar macau says:

    I’m still learning from you, but I’m trying to achieve my goals. I certainly liked reading all that is written on your website.Keep the aarticles coming. I enjoyed it!

  21. I’m impressed, I need to say. Actually not often do I encounter a weblog that’s each educative and entertaining, and let me tell you, you might have hit the nail on the head. Your idea is outstanding; the problem is something that not enough individuals are talking intelligently about. I’m very happy that I stumbled across this in my search for something relating to this.

  22. I am glad to be one of the visitants on this great internet site (:, regards for posting.

  23. kakahoki's avatar kakahoki says:

    Very good written post. It will be beneficial to everyone who employess it, as well as yours truly :). Keep up the good work – looking forward to more posts.

  24. quiz4d login's avatar quiz4d login says:

    I like forgathering utile information , this post has got me even more info! .

  25. Good write-up, I am regular visitor of one?¦s blog, maintain up the excellent operate, and It is going to be a regular visitor for a lengthy time.

  26. lawu88slot's avatar lawu88slot says:

    Hmm is anyone else having problems with the images on this blog loading? I’m trying to determine if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.

  27. 78win's avatar 78win says:

    959156 446089Locate out these pointers read on and learn to know how to submit an application doing this that you policy your corporation today. alertpay 889005

  28. Normally I don’t learn article on blogs, however I wish to say that this write-up very pressured me to check out and do it! Your writing taste has been amazed me. Thanks, very great post.

  29. hi!,I really like your writing so a lot! share we keep in touch more about your article on AOL? I require a specialist on this house to solve my problem. Maybe that’s you! Looking forward to peer you.

  30. Tired of Tinnitus or Hearing Problems? Here’s a Natural Solution That’s Changing Lives Are you constantly bothered by ringing in the ears (tinnitus), hearing difficulties, or sound clarity issues?

  31. Thank you for sharing with us, I think this website really stands out : D.

  32. WONDERFUL Post.thanks for share..extra wait .. …

  33. LottoChamp is a specialized lottery prediction software designed to give players a statistical edge. Instead of relying on luck or random numbers, the platform uses mathematical algorithms and historical draw data to help users make more strategic number selections.

  34. excellent put up, very informative. I wonder why the other specialists of this sector do not notice this. You should proceed your writing. I am sure, you’ve a great readers’ base already!

  35. Someone essentially help to make seriously articles I would state. This is the first time I frequented your website page and thus far? I surprised with the research you made to create this particular publish incredible. Wonderful job!

  36. PROSTADINE is truly unlike anything you’ve ever encountered in your life. It stands as the sole droplet solution that incorporates nine potent natural ingredients, working in perfect synergy to safeguard the health and mineral balance of your prostate well into your golden years.

  37. alexaslot138's avatar alexaslot138 says:

    My brother recommended I might like this blog. He was entirely right. This put up truly made my day. You can not imagine just how a lot time I had spent for this information! Thank you!

  38. The ice water hack is a simple trick that involves using cold water to naturally activate your body’s thermogenic process. When you drink ice water, your body has to work harder to regulate its temperature, burning extra calories in the process.

  39. alexaslot138's avatar alexaslot138 says:

    Wow! This could be one particular of the most useful blogs We have ever arrive across on this subject. Actually Excellent. I’m also a specialist in this topic therefore I can understand your effort.

  40. rajabotak's avatar rajabotak says:

    There is noticeably a bundle to know about this. I assume you made sure nice factors in features also.

  41. Many men who have tried the blue salt trick report increased stamina, better performance, and a renewed sense of confidence.

  42. alexaslot138's avatar alexaslot138 says:

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

  43. I truly enjoy studying on this internet site, it contains excellent blog posts.

  44. siokambing5's avatar siokambing5 says:

    Only wanna input that you have a very decent site, I like the pattern it really stands out.

  45. Good ?V I should certainly pronounce, impressed with your website. I had no trouble navigating through all the tabs and related info ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, site theme . a tones way for your customer to communicate. Nice task..

  46. Sleep Lean is a natural nighttime weight management supplement designed to help you burn fat, improve sleep quality, and balance hormones—all while you rest.

  47. paus empire's avatar paus empire says:

    Very interesting topic, thankyou for putting up. “Challenge is a dragon with a gift in its mouthTame the dragon and the gift is yours.” by Noela Evans.

  48. Hey There. I found your blog using msn. This is a really well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I will definitely comeback.

  49. The Pink Salt Trick is a minimalist but effective morning routine: Just drink a glass of lukewarm water mixed with a pinch of Himalayan pink salt as soon as you wake up.

Comments are closed.