Created
January 1, 2016 12:10
-
-
Save BojanKomazec/8ac5728163b1db72768a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MyApp | |
{ | |
internal enum MyEnum | |
{ | |
Value1, | |
Value2, | |
Value3, | |
} | |
public class MyClass | |
{ | |
private MyEnum _myEnum; | |
public int Foo(string s) | |
{ | |
if (s == null) | |
{ | |
throw new ArgumentNullException(nameof(s)); | |
} | |
int retVal = 0; | |
switch(this._myEnum) | |
{ | |
case MyEnum.Value1: | |
case MyEnum.Value2: | |
retVal = 1; | |
break; | |
case MyEnum.Value3: | |
retVal = s.Length; | |
break; | |
} | |
return retVal; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment