title: Reflection For Static Class in C#
body: <p>I have created a Static Class and used that in Reflection.
  But when i accessed the Methods of that class, its showing 5 methods but i have created only 1.
  The extra methods are </p>
  
  <pre><code>Write
  ToString
  Equals
  GetHashCode
  GetType
  </code></pre>
  
  <p>But i have created only the Write methods.</p>
  
  <p>One static methods can be in a static class but these extra 4 methods are not statics and from where they have drived. What is the base class for that</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  using System.Reflection;
  
  namespace ReflectionDemo
  {
      static class ReflectionTest
      {
          public static int Height;
          public static int Width;
          public static int Weight;
          public static string Name;
  
          public static void Write()
          {
              Type type = typeof(ReflectionTest);         //Get type pointer
              FieldInfo[] fields = type.GetFields();      //obtain all fields
              MethodInfo[] methods = type.GetMethods();
              Console.WriteLine(type);
              foreach (var item in methods)
              {
                  string name = item.Name;
                  Console.WriteLine(name);
              }
  
              foreach (var field in fields)
              {
                  string name = field.Name; //(null); //Get value
                  object temp = field.GetValue(name);
                  if (temp is int) //see if it is an integer
                  {
                      int value = (int)temp;
                      Console.Write(name);
                      Console.Write("(int) = ");
                      Console.WriteLine(value);
                  }
                  else if (temp is string)
                  {
                      string value = temp as string;
                      Console.Write(name);
                      Console.Write("(string) = ");
                      Console.WriteLine(value);
                  }
              }
          }        
      }
      class Program
      {
          static void Main(string[] args)
          {
              ReflectionTest.Height = 100;
              ReflectionTest.Width = 50;
              ReflectionTest.Weight = 300;
              ReflectionTest.Name = "Perl";
  
              ReflectionTest.Write();
  
              Console.ReadLine();            
          }
      }
  }
  </code></pre>
  
  <p>But how to create an object of a static class to access those methods
  static class cannot have non static methods</p>