Deozaan

Enum Alternative

Mar 9th, 2013
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. // old enum that I had to cast as e.g., (byte)RFCs.SyncSpeed to get 10 as a byte
  2. public enum RFCs {
  3.     // Plane.cs RFCs
  4.     SyncSpeed = 10,
  5.     UTurnLeft = 11,
  6.     UTurnRight = 12,
  7.     RollUpright = 13,
  8.     UpdatePosition = 14,
  9.     UpdateRotation = 15,
  10.     SyncPitch = 16,
  11. }
  12.  
  13. // new class that gives me the byte I wanted!
  14. public static class RFCs {
  15.     // Plane.cs RFCs
  16.     public const byte SyncSpeed = 10;
  17.     public const byte UTurnLeft = 11;
  18.     public const byte UTurnRight = 12;
  19.     public const byte RollUpright = 13;
  20.     public const byte UpdatePosition = 14;
  21.     public const byte UpdateRotation = 15;
  22.     public const byte SyncPitch = 16;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment