title: C# solving pseudocode to help understanding delegates&lambda
body: <p>I have trouble understanding lambdas, delegates and so on, I hope with someone giving me a solution to my problem I am able to understand those better. Basically it is possible to <em>create (or change) the body</em> of a method when an object of the class is initialized, no?
  Kinda like this:</p>
  
  <p>Let's say I have 1 classes: Class A, which looks like this:</p>
  
  <pre><code>public class ClassA{
     int i;
  
     public ClassA(int number)
     {
     i = number;
     }
  
     public void Foo(){}
  }
  </code></pre>
  
  <p>For demonstration purposes very minimalistic, now I also have somewhere else the static main, and what I want to do there is following: Creating multiple objects of ClassA and make it so that when I call ClassA.Foo I get different results I can determine myself, how is it supposed to look Syntax wise?</p>
  
  <pre><code>static void Main(string[] args)
  {
      ClassA FooBlue = New ClassA(1){
                       public void Foo()
                       {
                       System.Console.WriteLine("I am a Fooranger Blue!");
                       };
  
      ClassA FooPink = New ClassA(2){
                       public void Foo()
                       {
                       System.Console.WriteLine("My  color is the manliest!");
                       };
      ...
  </code></pre>
  
  <p>So now when I do this:</p>
  
  <pre><code>    ...
      FooBlue.Foo();
      FooPink.Foo();
      System.Console.ReadLine();
  }
  </code></pre>
  
  <p>I get following output on the console:</p>
  
  <pre><code>"I am a Fooranger Blue!"
  "My color is the manliest!"
  </code></pre>
  
  <p>I just mention again that this is an example and by no means anything out of praxis but for the purpose of me understanding that stuff it would be great if someone can provide an answer that gives the desired solution, including the <em>useless</em> integer i.</p>