简体   繁体   中英

How to use enum passed to dll as method parameter?

Enum in my main application:

enum variable
{
    NULL,
    low,
    high
}

Main function in my dll:

class MainClass
{
    Enum variable;

    public static string Start(Enum variable)
    {
        variable = variable;
    }
}

And now I want to create a struct in another file in my dll with field of variable type but I get an error: "The type or namespace name 'variable' could not be found (are you missing a using directive or an assembly reference?)" What can I do about it?

struct NewStruct
{
    string word;
    variable v;
}

Try this.. (but only for test.. it is crepy code:D)

class MainClass
{
    variable myenum; //Not Enum

    public static string Start(variable tmpval)
    {
        myenum = tmpval;

        return string.Empty; //this method needs a return value
    }
}

I hope this isn't productive code..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM