title: how inheritance replace the switch case?
body: <p>I m using C# Switch case how i can replace using inheritance.
  case is like 1,2,3,4 so
  how i can implement it.</p>
  
  <p>for eg: </p>
  
  <pre><code>    public Blocks(int code)
      {
           bool[,] shp1;
  
          switch (code)
          {
              case 1:
                  this._Width = 4;
                  this._Height = 1;
                  this._Top = 0;
                  this._Left = 4;
  
                  shp1 = new bool[_Width, _Height];
                  shp1[0, 0] = true;
                  shp1[1, 0] = true;
                  shp1[2, 0] = true;
                  shp1[3, 0] = true;
                  this.Shape = shp1;
                  break;
  
              case 2:
                  this._Width = 2;
                  this._Height = 2;
                  this._Top = 0;
                  this._Left = 4;
  
                  shp1 = new bool[_Width, _Height];
                  shp1[0, 0] = true;
                  shp1[0, 1] = true;
                  shp1[1, 0] = true;
                  shp1[1, 1] = true;
                  this.Shape = shp1;
                  break;
  
  
              default:
                  throw new ArgumentException("Invalid Block Code");
          }
      }
  </code></pre>