text: Q:
  
  Class or Enum structure for control types and codes
  
  I would like to implement a class with control codes for the peers of my socket communication. I tried it with enums and derived classes but my tries doesn't work.
  I would like to have a Type which contains different Codes. For example Control as type with Wakeup and Shutdown as code information's.
  The peer should be able to use a Switch Case to identify the information. Something like:
  switch(data.Type)
  {
      case Control:
          /* Check diffrent codes */
      break;
      case Notification:
          /* Check diffrent codes */
      break;
  }
  
  I tried it with following, but sadly I cannot use Switch Case or similar to identify the information.
  public abstract class Type
  {
      private readonly String _code;
  
      protected Type(String code)
      {
          _code = code;
      }
  
      public String Code
      {
          get { return _code; }
      }
  }
  
  public sealed class Control : Type
  {
      public static readonly Control Wakeup = new Control("Wakeup");
      public static readonly Control Shutdown = new Control("Shutdown");
  
      private Control(String code) : base(code)
      {
      }
  }
  
  Any Idea how to implement this? Please consider, that TypeXXX should not combinable with CodeYYYY. Thanks for your advices!
  Edit
  I have a TCP Client and Server Socket. The general communication works fine. Now I would like to implement a class or something similar that tells the peer which kind of information he received. That he is able to decide what he should he do with the information. I thought something like the ICMP Control Messages would be nice. I have a general Type of Information and the Code specify it.
  The type code relationship looks like this:
  +--------------+-------------+
  |     Type     |    Code     |
  +--------------+-------------+
  | Control      | Shutdown    |
  |              | Wakeup      |
  |              | CheckUpdate |
  |              | ForceUpdate |
  | -----------  | ----------- |
  | Notification | Online      |
  |              | Offline     |
  |              | Login       |
  |              | Logoff      |
  | -----------  | ----------- |
  | Data         | Zip         |
  +--------------+-------------+
  
  The package looks like this:
  +------+------+---------+
  | Type | Code | Payload |
  +------+------+---------+
  
  The receiver checks the Type and Code and after that start to process the payload.
  
  A:
  
  Create two classes that inherits from Control class:
  public class WakeUp : Control
  {
  }
  
  public class ShutDown : Control
  {
  }
  
  Then use this method to create a new instance of the specific control:
  public T CreateControl<T>() where T : Control, new()
  {
      return new T();
  }
  
  Use the above method as:
  var wakeupControl = CreateControl<WakeUp>();
  var shutdownControl = CreateControl<ShutDown>();
  
  UPDATE:
  Have a look at the strategy pattern http://www.dofactory.com/Patterns/PatternStrategy.aspx
  
  