Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2. public class C {
  3.    
  4.     enum Color {
  5.         red,
  6.         blue,
  7.         noColor    // This will be deprecated.
  8.     }
  9.    
  10.     public void M1() {
  11.         var castValue = ((int)Color.blue + (int)Color.blue);
  12.         PrintColor((Color)castValue); // Do you want to allert this usage?
  13.     }
  14.    
  15.     public void M2(int value) {
  16.         PrintColor((Color)value); // Do you want to allert this usage when value is `2`?
  17.     }
  18.    
  19.     void PrintColor(Color color)
  20.     {
  21.         Console.WriteLine(color);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement