"Nested Methods / Functions" - C#


Can you please provide me simple examples on:

"Nested Methods / Functions" - C#

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anarki_jimbelSenior DeveloperCommented:
I was thinking to give my examples but decided it would be better if you read the following discussions:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
käµfm³d 👽Commented:

anarki_jimbel's first link is perfect (I think). Specifically (in case you don't see it), you are passing behaviors around rather than just simply data. I hadn't really ever thought of it that way, but now that I hear it it sounds spot on.
milani_lucieAuthor Commented:

Func<int, int>

means function takes "int" type of data and returns "int" type of data. Am i correct ?

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

käµfm³d 👽Commented:
It took me a while to understand this, but yes:  the last T is the type of the result; all other Ts in a type list are the types of the parameters to the delegate. So a Func<string, int, char, double> would return a double, and it would take three parameters:  a string, an int, and a char.
milani_lucieAuthor Commented:

If a function does not return a value then

Func< >

How to declare this ?

käµfm³d 👽Commented:
Use Action.
milani_lucieAuthor Commented:
Got it. Thanks a lot.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.