Q:

Is it possible to use switch statement inside class member function and get accessor?

Here is the class (relax, it's just an example and not intended for concrete use):
public class Sample
{
    public Sample()
    {
    }

    public string Size
    {
        get
        {
            switch (index)
            {
                case 0: return 100;
                        break;
                case 1: return 500;
                        break;
                case 2: return 1000;
                        break;
                ...
            }
        }
    }
}

I am getting an "Unreachable code detected" error on the break keyword.  Is it even possible to write switch statements inside a class or class member function?  Or,  am I stuck with if-else blocks?
Based on the feedback below, I see I made a silly error, with return preceding the break

A:

The "unreachable code" warning is because your break statements are immediately following a return statement. Therefore, the break is never executed.

A:

You are getting a unreachable code on the break because the code is unreachable.  The return ensures that.  You can just remove the break statements and everything should work fine.
You can rewrite the switch in either of these two ways:
switch(index)
{
  case 0: return 100;
  case 1: return 500;
  case 2: return 1000;
}

or
int value = 0;
switch(index)
{
   case 0:
     value = 100;
     break;
   case 1:
     value = 500;
     break;
   case 2:
     value = 1000;
     break;
}
return value;

