Assign a function to a variable in C#
<p>i saw a function can be define in javascript like </p>

<pre><code>var square = function(number) {return number * number};
</code></pre>

<p>and can be called like </p>

<pre><code>square(2);

var factorial = function fac(n) {return n&lt;3 ? n : n*fac(n-1)};
print(factorial(3));
</code></pre>

<h2>c# code</h2>

<pre><code>MyDelegate writeMessage = delegate ()
                              {
                                  Console.WriteLine("I'm called");
                              };
</code></pre>

<p>so i need to know that can i define a function in the same way in c#. if yes then just give a small snippet of above like function definition in c# please. thanks.</p>
