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

    There is noticeably a lot to realize about this. I think you made some good points in features also.

  2. Some really quality blog posts on this internet site, saved to bookmarks.

  3. Perfectly written articles, Really enjoyed looking through.

  4. 4d's avatar 4d says:

    Hi there would you mind stating which blog platform you’re using? I’m planning to start my own blog in the near future but I’m having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something unique. P.S Apologies for being off-topic but I had to ask!

  5. indocair's avatar indocair says:

    This is the best blog for anyone who desires to seek out out about this topic. You realize a lot its virtually exhausting to argue with you (not that I actually would need…HaHa). You definitely put a brand new spin on a topic thats been written about for years. Nice stuff, just nice!

  6. I cling on to listening to the news update speak about getting boundless online grant applications so I have been looking around for the finest site to get one. Could you advise me please, where could i find some?

  7. You completed a few nice points there. I did a search on the subject and found mainly people will agree with your blog.

  8. Some genuinely nice and useful info on this website , as well I think the layout holds good features.

  9. I’m really loving the theme/design of your blog. Do you ever run into any browser compatibility issues? A couple of my blog readers have complained about my blog not operating correctly in Explorer but looks great in Safari. Do you have any solutions to help fix this problem?

  10. As I website possessor I think the content here is rattling wonderful, thanks for your efforts.

  11. fantastic post.Never knew this, appreciate it for letting me know.

  12. Can I just say what a aid to search out somebody who actually knows what theyre speaking about on the internet. You positively know how to deliver an issue to light and make it important. Extra people must read this and perceive this facet of the story. I cant consider youre no more popular because you positively have the gift.

  13. Hi there, I found your blog by means of Google even as searching for a comparable subject, your site came up, it appears to be like great. I’ve bookmarked it in my google bookmarks.

  14. hi!,I like your writing so much! proportion we be in contact more about your article on AOL? I need an expert in this house to solve my problem. May be that is you! Taking a look forward to see you.

  15. I like this website because so much useful material on here : D.

  16. It¦s actually a great and useful piece of information. I am glad that you simply shared this useful information with us. Please stay us informed like this. Thanks for sharing.

  17. Scholarships's avatar Scholarships says:

    Does your blog have a contact page? I’m having problems locating it but, I’d like to send you an email. I’ve got some suggestions for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it expand over time.

  18. wonderful post.Ne’er knew this, thankyou for letting me know.

  19. I have been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did, the web will be a lot more useful than ever before.

  20. very nice post, i certainly love this web site, carry on it

  21. Some really terrific work on behalf of the owner of this site, perfectly great subject matter.

  22. Very well written post. It will be beneficial to anybody who utilizes it, including myself. Keep doing what you are doing – i will definitely read more posts.

  23. Great post. I am facing a couple of these problems.

  24. Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a bit, but instead of that, this is excellent blog. A great read. I will definitely be back.

  25. bidencash's avatar bidencash says:

    It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I want to suggest you some interesting things or advice. Maybe you can write next articles referring to this article. I wish to read even more things about it!

  26. You are my aspiration, I have few blogs and occasionally run out from brand :). “He who controls the past commands the future. He who commands the future conquers the past.” by George Orwell.

  27. obviously like your website but you need to test the spelling on several of your posts. Many of them are rife with spelling issues and I find it very troublesome to tell the truth then again I?¦ll surely come back again.

  28. You have remarked very interesting points! ps decent web site. “We make ourselves a ladder out of our vices if we trample the vices themselves underfoot.” by Saint Augustine.

  29. I like this web site very much so much wonderful information.

  30. I’m typically to running a blog and i really respect your content. The article has actually peaks my interest. I am going to bookmark your website and maintain checking for brand spanking new information.

  31. Super-Duper blog! I am loving it!! Will be back later to read some more. I am bookmarking your feeds also

  32. I saw a lot of website but I conceive this one has something special in it in it

  33. I believe you have mentioned some very interesting points, thanks for the post.

  34. lindaydulce's avatar lindaydulce says:

    What i do not realize is if truth be told how you’re now not actually a lot more well-appreciated than you might be now. You’re very intelligent. You know therefore significantly relating to this topic, made me personally imagine it from numerous numerous angles. Its like men and women are not fascinated unless it¦s one thing to accomplish with Lady gaga! Your individual stuffs excellent. Always maintain it up!

  35. Awsome article and right to the point. I am not sure if this is really the best place to ask but do you folks have any ideea where to get some professional writers? Thanks in advance 🙂

  36. This design is steller! You obviously know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

  37. Some really nice stuff on this internet site, I like it.

  38. I want reading through and I conceive this website got some truly utilitarian stuff on it! .

  39. I conceive this web site has some very wonderful information for everyone : D.

  40. I adore forgathering useful info, this post has got me even more info! .

  41. japritoto's avatar japritoto says:

    Hello my family member! I wish to say that this article is awesome, great written and come with approximately all significant infos. I¦d like to see more posts like this .

  42. You are a very smart individual!

  43. situs togel's avatar situs togel says:

    Hello! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa? My site discusses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you might be interested feel free to send me an e-mail. I look forward to hearing from you! Wonderful blog by the way!

  44. Saved as a favorite, I really like your blog!

  45. japritoto's avatar japritoto says:

    Loving the info on this website , you have done outstanding job on the posts.

  46. situs macau's avatar situs macau says:

    Great web site. Plenty of helpful information here. I am sending it to a few pals ans also sharing in delicious. And obviously, thank you on your effort!

  47. Thank you for the sensible critique. Me & my neighbor were just preparing to do a little research about this. We got a grab a book from our area library but I think I learned more from this post. I’m very glad to see such great information being shared freely out there.

  48. I do love the manner in which you have presented this particular challenge and it does indeed present me a lot of fodder for consideration. On the other hand, coming from just what I have observed, I only hope when the remarks stack on that individuals stay on issue and don’t get started upon a tirade regarding some other news du jour. Yet, thank you for this excellent point and although I do not concur with it in totality, I respect the viewpoint.

  49. Greetings! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us beneficial information to work on. You have done a outstanding job!

Comments are closed.