[Tip] Use C# snippet to be more productive

Snippet is so convenient to use in C#!

I need to get the way / list of getting snippets in C# later on really!

Now give a good example of using snippet to write switch:

enum Months { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec }

Months curMonth = Months.Feb;

Now go to the maggic:

1. type sw, and TAB twice.

2. Now you get an blank switch with a green area.

3. Input curMonth as the wanted data to be switched.

4. Oh, the green area is still there. Press Enter, and now you get:

  switch (curMonth)
            {
                case Months.Jan:
                    break;
                case Months.Feb:
                    break;
                case Months.Mar:
                    break;
                case Months.Apr:
                    break;
                case Months.May:
                    break;
                case Months.Jun:
                    break;
                case Months.Jul:
                    break;
                case Months.Aug:
                    break;
                case Months.Sep:
                    break;
                case Months.Oct:
                    break;
                case Months.Nov:
                    break;
                case Months.Dec:
                    break;
                default:
                    break;
            }

Go on learning!

原文地址:https://www.cnblogs.com/taoxu0903/p/1671152.html