Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can I use local method in method Pin
OriginalGriff17-Oct-14 23:52
mveOriginalGriff17-Oct-14 23:52 
GeneralRe: Can I use local method in method Pin
Member 1115157118-Oct-14 0:06
Member 1115157118-Oct-14 0:06 
GeneralRe: Can I use local method in method Pin
OriginalGriff18-Oct-14 0:10
mveOriginalGriff18-Oct-14 0:10 
GeneralRe: Can I use local method in method Pin
Member 1115157118-Oct-14 0:15
Member 1115157118-Oct-14 0:15 
GeneralRe: Can I use local method in method Pin
OriginalGriff18-Oct-14 0:21
mveOriginalGriff18-Oct-14 0:21 
GeneralRe: Can I use local method in method Pin
BillWoodruff18-Oct-14 1:45
professionalBillWoodruff18-Oct-14 1:45 
GeneralRe: Can I use local method in method Pin
OriginalGriff18-Oct-14 1:55
mveOriginalGriff18-Oct-14 1:55 
AnswerRe: Can I use local method in method Pin
BillWoodruff17-Oct-14 22:31
professionalBillWoodruff17-Oct-14 22:31 
Note that C# does not, like Pascal, have a separate syntax for procedures (do not return a value) and functions (return a value): in C# both are termed "methods."

There's no direct equivalent in C# to Pascal's nested functions where the inner functions have access to the variables in their "container" ... if that's what you are asking.

What exactly do you mean by "in program method:" do you mean in the Program.cs class that in the default Windows Forms application contains the 'Main method ?

It's easier to say where you can't create methods:

1. outside a NameSpace

2. inside a Method

However, one can, in a way, create methods inside methods by creating instances of delegates or anonymous methods/lambda expressions. The 'Action and 'Func delegates are useful to define methods inside a method.

And, you can have nested Classes in .NET, with each Class containing methods: by making an inner Class static one can easily execute the method given an instance of the outer Class.
« There is only one difference between a madman and me. The madman thinks he is sane. I know I am mad. » Salvador Dali


modified 18-Oct-14 4:39am.

GeneralRe: Can I use local method in method Pin
Member 1115157117-Oct-14 22:43
Member 1115157117-Oct-14 22:43 
QuestionDeepCopy Not Working Pin
Kevin Marois17-Oct-14 8:28
professionalKevin Marois17-Oct-14 8:28 
AnswerRe: DeepCopy Not Working Pin
BillWoodruff17-Oct-14 8:42
professionalBillWoodruff17-Oct-14 8:42 
AnswerRe: DeepCopy Not Working Pin
Rob Philpott19-Oct-14 7:46
Rob Philpott19-Oct-14 7:46 
AnswerRe: DeepCopy Not Working Pin
Bernhard Hiller19-Oct-14 22:26
Bernhard Hiller19-Oct-14 22:26 
QuestionC# Socket Communication Pin
Lillepige17-Oct-14 8:17
Lillepige17-Oct-14 8:17 
AnswerRe: C# Socket Communication Pin
Richard Andrew x6417-Oct-14 9:49
professionalRichard Andrew x6417-Oct-14 9:49 
AnswerRe: C# Socket Communication Pin
Dave Kreskowiak17-Oct-14 9:52
mveDave Kreskowiak17-Oct-14 9:52 
AnswerRe: C# Socket Communication Pin
Eddy Vluggen17-Oct-14 10:49
professionalEddy Vluggen17-Oct-14 10:49 
AnswerRe: C# Socket Communication Pin
Cai Wallis-Jones18-Oct-14 1:40
Cai Wallis-Jones18-Oct-14 1:40 
GeneralC sharp file creation at specified time. Pin
kanswal7717-Oct-14 3:54
kanswal7717-Oct-14 3:54 
GeneralRe: C sharp file creation at specified time. Pin
BillWoodruff17-Oct-14 3:58
professionalBillWoodruff17-Oct-14 3:58 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7717-Oct-14 5:53
kanswal7717-Oct-14 5:53 
GeneralRe: C sharp file creation at specified time. Pin
BillWoodruff17-Oct-14 6:25
professionalBillWoodruff17-Oct-14 6:25 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7717-Oct-14 6:34
kanswal7717-Oct-14 6:34 
GeneralRe: C sharp file creation at specified time. Pin
BillWoodruff17-Oct-14 7:47
professionalBillWoodruff17-Oct-14 7:47 
GeneralRe: C sharp file creation at specified time. Pin
kanswal7718-Oct-14 17:24
kanswal7718-Oct-14 17:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.