C# - Convert String to Class Object

后端 未结 3 1948
野的像风
野的像风 2021-01-19 10:47

I am working with someone else\'s code and trying to make some modifications. So what I\'m needing to do is take the following:

RemoteFileDP remoteFile = ne         


        
3条回答
  •  既然无缘
    2021-01-19 11:13

    You're missing a constructor that takes a string as a parameter. Try your code with

    public RemoteFileDP(string locationDirectory)
    {
        // do stuff with locationDirectory to initialize RemoteFileDP appropriately
    }
    

    Of course, if you do that, why not just call the constructor directly?

    RemoteFileDP remoteFile = new RemoteFileDP(locationDirectory);
    

提交回复
热议问题