0

honestly - i don't have the slightest idea of how to go about doing this and any help will be appreciated.

so i have class that handles file information and based on the file information it will be stored in one of the two possible ways. Deciding which one of the two to handle the file will be based on an enum.

public class Route1
{
    public enum Route1Type
    {
        OneWay,
        TwoWay
    };
}

Other enum class:

public class Route2
{
    public enum Route2Type
    {
        publicMade,
        privateMade
    };
}

Main class dealing with enums:

public class MyClass
    {
        private MyService _Svc;
        public IOtherClass OtherClass{ get; private set; } 

        public enum Route2Type { publicMade, privateMade }
        public enum Route1Type { OneWay, TwoWay}

        public MyClass(MyService svc, Route2Type route2Type)
        {
            _Svc = svc;

            //retrieve from MyService for the route2 type configuration based on the enum
            //retrieve from MyService  the route1 type
            /*if (route2Type.Equals(route1Type.OneWay))
                OtherClass= new OtherClass.OneWay();
            else
                OtherClass= new OtherClass.TwoWay();
             */
        }

I am lost on where to start to think of how i can implement what is in the comments. Any help would be great.

OneWay()

public OneWay(string user, string password, string aurl)
        {
            _resource = new Resource(new WebdavSession(new NetworkCredential(user, password)), aurl);
            _aurl = aurl; 

_user = user; }

TwoWay

public TwoWay(string aPath)
        {
            _aPath = aPath;
        }

MyService

public MyService(Guid AGuid, Guid BGuid)
        {
            _aGuid = AGuid;
            _bGuid = BGuid;
        }
4

1 回答 1

0

您只想验证 route2Type 具有哪个枚举值?

 if(route2Type == Route2Type.publicMade)
      OtherClass= new OtherClass.OneWay();
 else
      OtherClass= new OtherClass.TwoWay();
于 2013-08-02T14:27:54.747 回答