Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
enum extension
using System; namespace Rextester { public enum State : int { StateA = 1, StateB } public enum DifferentState : int { StateA = 1, StateB } public static class Extensions { public static bool CompareInt(this Enum lhs, int rhs) { return Convert.ToInt32(lhs) == rhs; } } public class Program { public static void Main(string[] args) { State foo = State.StateA; Console.WriteLine(foo.CompareInt(1)); Console.WriteLine(foo.CompareInt(2)); DifferentState bar = DifferentState.StateB; Console.WriteLine(bar.CompareInt(1)); Console.WriteLine(bar.CompareInt(2)); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Selection sort
HRGFCSFCA S
Project Euler Problem 10
expression evaluator wich is easy to extend
Planet-D
перегружаемый оператор
Pascal Triangle
gggsggsgg
sdfghjuyhtgrfedsdf
Enum.IsDefined
Please log in to post a comment.