Run Code
|
API
|
Code Wall
|
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
Url Encode
show IP
Func Delegate
Nice Stuff
BST
sdfghjikujyhtgrfedwcdf
Knapsack Problem
T
testing
Comparing hashing with different encoding and also transferring bytes