String conversions

Enum.Parse converts a string to an enum.

It accepts the enum type and a string that can include multiple members:


using System;
using System.Numerics;

enum WeekDay
{
    Monday, Tuesday, Wednesday, Thursday, Friday
}

class Sample
{
    public static void Main()
    {
        WeekDay w = (WeekDay)Enum.Parse(typeof(WeekDay), "Monday, Tuesday");

    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.