delegate type inside a method
Hi All,
I am new to c# programming so sorry for asking a trivial question. I have a small query. I have read that "delegate type and ordinary types cannot be defined inside a method". I want to know what is the reason behind this.can anybody explain this to me?
Re: delegate type inside a method
You can use anonymous delegates (C# 2.0) and lambda expressions (C# 3.0). For types you can use anonymous types (C# 3.0).
Re: delegate type inside a method
Reason? It was designed this way. Maybe because it helps keep the grammar and the compiler simplier. Maybe be because it helps to obey minimal feature set which can be common for most of languages and platforms, in other words it is a way how to obey the CLS/CTS standards.