Solved

"Nested Methods / Functions" - C#

Posted on 2012-03-26
7
362 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
ID: 37768489
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 75

Expert Comment

by:käµfm³d 👽
ID: 37768543
_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
ID: 37768628
Hi,

Func<int, int>

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

Thanks
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 37768637
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
ID: 37768777
Kaufmed,

If a function does not return a value then

Func< >

How to declare this ?

Thanks
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 37769227
Use Action.
0
 

Author Comment

by:milani_lucie
ID: 37771320
Got it. Thanks a lot.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server Error 11 58
User Authentication using Digital Certificate 2 46
how to check to see if datatable has headers or not 2 27
How come this regular expression allows "e"? 14 36
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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