Function Body Expression in C#

Function body expression is convenient when we make a less complicated function in C#. The body expression can decrease our workload dramatically when we are developing a large project.


Original Function

public float AverageThreeScores(float a, float b, float c)
{
     return (a + b + c) / 3;
}

Function body Expression

The function above is quite simple. It takes three parameters and returns the average value of the three parameters. The following code snippet is a simplified version, which does the same job.

public float AverageThreeScores(float a, float b, float c) => (a + b + c) / 3;

7 Replies to “Function Body Expression in C#”

  1. I needed to post you that little bit of observation to say thanks once again for your magnificent pointers you’ve featured in this article. It is quite remarkably generous of people like you to give openly just what a number of us might have marketed as an e book to end up making some dough for themselves, most notably given that you could possibly have done it if you ever decided. These pointers as well served like the fantastic way to fully grasp other people have similar eagerness much like my own to know lots more on the topic of this issue. I am certain there are millions of more fun opportunities in the future for individuals who looked at your blog post.

  2. My husband and i ended up being contented Chris could complete his basic research by way of the ideas he came across from your own blog. It’s not at all simplistic just to always be giving away guidelines many others could have been making money from. And we consider we’ve got the blog owner to appreciate because of that. All the explanations you’ve made, the easy blog menu, the friendships you aid to create – it’s all astounding, and it’s aiding our son and our family consider that that concept is awesome, and that’s exceptionally fundamental. Many thanks for all!

  3. I enjoy you because of all of your effort on this blog. Ellie enjoys doing internet research and it’s easy to see why. All of us hear all about the compelling manner you create functional ideas by means of the blog and as well cause contribution from other ones about this article and my child is being taught a great deal. Enjoy the remaining portion of the new year. You’re the one carrying out a fantastic job.

  4. Thanks for the useful information on credit repair on your web-site. The thing I would offer as advice to people will be to give up a mentality they will buy at this moment and pay back later. As being a society most people tend to repeat this for many factors. This includes family vacations, furniture, plus items we really want to have. However, you must separate a person’s wants from the needs. When you’re working to fix your credit score you really have to make some trade-offs. For example you possibly can shop online to economize or you can click on second hand suppliers instead of highly-priced department stores to get clothing.

  5. I simply wished to thank you very much yet again. I do not know what I would have used without those tips and hints shown by you relating to this theme. Previously it was the traumatic setting in my view, nevertheless viewing your well-written technique you treated the issue took me to weep with joy. Now i am thankful for your work as well as trust you recognize what an amazing job you were undertaking training the others with the aid of your website. Probably you haven’t met any of us.

Leave a Reply

Your email address will not be published. Required fields are marked *