Skip to content

Instantly share code, notes, and snippets.

@BojanKomazec
Created January 1, 2016 12:10
Show Gist options
  • Save BojanKomazec/8ac5728163b1db72768a to your computer and use it in GitHub Desktop.
Save BojanKomazec/8ac5728163b1db72768a to your computer and use it in GitHub Desktop.
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