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

** Note ** Jesse is currently looking for a new position. You can learn more about him at https://jesseliberty.bio Thank you. 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. His latest book, Building APIs with .NET, is now available wherever you buy your books. Liberty 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 13 year Microsoft MVP.
This entry was posted in C#, C# 12, Essentials. Bookmark the permalink.

1,500 Responses to Modern C# – Part 1

  1. I was looking through some of your articles on this website and I think this site is real informative! Keep on putting up.

  2. Hello. remarkable job. I did not imagine this. This is a splendid story. Thanks!

  3. Appreciating the hard work you put into your website and in depth information you provide. It’s good to come across a blog every once in a while that isn’t the same out of date rehashed material. Great read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  4. F*ckin’ amazing things here. I’m very satisfied to peer your article. Thank you so much and i’m having a look forward to touch you. Will you kindly drop me a mail?

  5. I just couldn’t go away your site before suggesting that I extremely enjoyed the standard information an individual supply to your guests? Is gonna be again steadily to check out new posts.

  6. Absolutely indited written content, thankyou for entropy.

  7. I will immediately grab your rss feed as I can not find your e-mail subscription link or newsletter service. Do you have any? Kindly let me know in order that I could subscribe. Thanks.

  8. My spouse and i got really satisfied that Michael could carry out his research through your precious recommendations he had out of your web site. It’s not at all simplistic just to happen to be giving away things some other people might have been selling. And we also already know we have you to be grateful to because of that. The entire illustrations you have made, the easy blog navigation, the relationships you can help to promote – it’s got mostly powerful, and it’s aiding our son and the family recognize that this article is enjoyable, which is certainly incredibly vital. Thanks for all the pieces!

  9. I have been absent for a while, but now I remember why I used to love this web site. Thank you, I?¦ll try and check back more often. How frequently you update your website?

  10. Hi! Do you know if they make any plugins to protect against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  11. I got what you mean , appreciate it for posting.Woh I am delighted to find this website through google. “Food is the most primitive form of comfort.” by Sheila Graham.

  12. Hello, i feel that i noticed you visited my site so i got here to “go back the prefer”.I’m trying to in finding issues to improve my web site!I assume its adequate to use some of your ideas!!

  13. I am not certain where you are getting your info, but great topic. I must spend some time finding out much more or understanding more. Thanks for wonderful info I used to be looking for this info for my mission.

  14. Unquestionably believe that which you said. Your favorite justification appeared to be on the internet the simplest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side effect , people can take a signal. Will probably be back to get more. Thanks

  15. Rattling instructive and great bodily structure of articles, now that’s user pleasant (:.

  16. Wohh precisely what I was looking for, thankyou for putting up.

  17. We are a group of volunteers and opening a new scheme in our community. Your site provided us with valuable info to work on. You have done a formidable job and our whole community will be grateful to you.

  18. pcxwin's avatar pcxwin says:

    I genuinely enjoy studying on this website , it contains good content. “The secret of eternal youth is arrested development.” by Alice Roosevelt Longworth.

  19. What’s Happening i’m new to this, I stumbled upon this I have found It positively useful and it has helped me out loads. I hope to contribute & help other users like its helped me. Good job.

  20. refractories's avatar refractories says:

    Great post. I was checking constantly this blog and I’m impressed! Very useful information specially the last part 🙂 I care for such information a lot. I was looking for this certain information for a long time. Thank you and good luck.

  21. Definitely consider that which you said. Your favourite justification seemed to be on the internet the simplest thing to have in mind of. I say to you, I certainly get annoyed at the same time as other people consider concerns that they just don’t recognize about. You managed to hit the nail upon the top and also outlined out the entire thing without having side effect , people could take a signal. Will likely be back to get more. Thank you

  22. I’m curious to find out what blog system you are utilizing? I’m experiencing some small security problems with my latest site and I’d like to find something more safeguarded. Do you have any suggestions?

  23. You are a very clever individual!

  24. I’m still learning from you, as I’m trying to reach my goals. I certainly love reading all that is posted on your website.Keep the stories coming. I loved it!

  25. Pretty! This was a really wonderful post. Thank you for your provided information.

  26. Great post, you have pointed out some excellent details , I too believe this s a very wonderful website.

  27. Timsothybioli's avatar Timsothybioli says:

    whoah this weblog is fantastic i really like studying your articles. Keep up the great work! You recognize, a lot of people are looking around for this info, you can aid them greatly.
    byueuropaviagraonline

  28. After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

  29. boostaro's avatar boostaro says:

    Really Appreciate this article, can I set it up so I receive an email sent to me whenever you make a new update?

  30. I am now not sure the place you are getting your info, but good topic. I needs to spend a while learning much more or understanding more. Thanks for excellent info I used to be looking for this info for my mission.

  31. iblbet's avatar iblbet says:

    Way cool, some valid points! I appreciate you making this article available, the rest of the site is also high quality. Have a fun.

  32. OLanepiliA's avatar OLanepiliA says:

    Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is excellent, as well as the content!
    byueuropaviagraonline

  33. I am constantly looking online for tips that can facilitate me. Thank you!

  34. miototo's avatar miototo says:

    This is really interesting, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your fantastic post. Also, I’ve shared your site in my social networks!

  35. It’s perfect time to make a few plans for the future and it is time to be happy. I’ve read this submit and if I may I want to recommend you some attention-grabbing issues or suggestions. Perhaps you could write next articles relating to this article. I want to read even more things about it!

  36. kilat333's avatar kilat333 says:

    Can I just say what a relief to seek out somebody who really knows what theyre talking about on the internet. You definitely know the way to carry a difficulty to mild and make it important. Extra individuals have to learn this and perceive this facet of the story. I cant imagine youre not more fashionable because you undoubtedly have the gift.

  37. I precisely had to say thanks all over again. I do not know the things I might have made to happen without the information shared by you concerning my concern. This has been a very depressing scenario in my opinion, but encountering a new skilled form you dealt with it took me to leap with contentment. Extremely happy for your support and as well , hope you comprehend what a great job you are always providing instructing the rest through your web site. I know that you have never got to know all of us.

  38. I enjoy the efforts you have put in this, thanks for all the great content.

  39. I have been reading out some of your stories and i can claim pretty clever stuff. I will surely bookmark your site.

  40. Thank you, I’ve recently been searching for info approximately this topic for a long time and yours is the greatest I have found out till now. But, what in regards to the bottom line? Are you sure about the supply?

  41. Please let me know if you’re looking for a writer for your blog. You have some really good articles and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please blast me an e-mail if interested. Many thanks!

  42. Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular BlogEngine.net.Thethoughts you express are really awesome. Hope you will right some more posts.

  43. Hi just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same outcome.

  44. Timsothybioli's avatar Timsothybioli says:

    Hey! This is kind of off topic but I need some advice from an established blog. Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about making my own but I’m not sure where to begin. Do you have any points or suggestions? Cheers

    glavonje

  45. Hey, I think your site might be having browser compatibility issues. When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, fantastic blog!

  46. Some truly terrific work on behalf of the owner of this website , absolutely outstanding subject material.

  47. Hello, Neat post. There’s an issue with your site in internet explorer, would check this… IE nonetheless is the market leader and a huge component to folks will omit your excellent writing because of this problem.

  48. I adore reading through and I believe this website got some really useful stuff on it! .

  49. wps下载's avatar wps下载 says:

    I conceive you have observed some very interesting points, regards for the post.

  50. kilat 333's avatar kilat 333 says:

    Hello there! I know this is kinda off topic but I’d figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog post or vice-versa? My website discusses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you’re interested feel free to shoot me an email. I look forward to hearing from you! Great blog by the way!

Comments are closed.