Solved

"Nested Methods / Functions" - C#

Posted on 2012-03-26
7
359 Views
Last Modified: 2012-03-27
Hi,

Can you please provide me simple examples on:

"Nested Methods / Functions" - C#

Thanks
0
Comment
Question by:milani_lucie
  • 3
  • 3
7 Comments
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
Comment Utility
I was thinking to give my examples but decided it would be better if you read the following discussions:
http://stackoverflow.com/questions/1919372/nested-methods-why-are-they-useful

http://www.go4expert.com/forums/showthread.php?t=3853
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
_NO POINTS_

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.
0
 

Author Comment

by:milani_lucie
Comment Utility
Hi,

Func<int, int>

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

Thanks
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
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.
0
 

Author Comment

by:milani_lucie
Comment Utility
Kaufmed,

If a function does not return a value then

Func< >

How to declare this ?

Thanks
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
Use Action.
0
 

Author Comment

by:milani_lucie
Comment Utility
Got it. Thanks a lot.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now