C# 如何使用传递给dll的枚举作为方法参数?
我的主应用程序中的枚举:C# 如何使用传递给dll的枚举作为方法参数?,c#,dll,enums,st,C#,Dll,Enums,St,我的主应用程序中的枚举: enum variable { NULL, low, high } my dll中的主要函数: class MainClass { Enum variable; public static string Start(Enum variable) { variable = variable; } } 现在我想在我的dll中的另一个文件中创建一个结构,该文件的字段为变量类型,但我得到一个错误: “
enum variable
{
NULL,
low,
high
}
my dll中的主要函数:
class MainClass
{
Enum variable;
public static string Start(Enum variable)
{
variable = variable;
}
}
现在我想在我的dll中的另一个文件中创建一个结构,该文件的字段为变量类型,但我得到一个错误:
“找不到类型或命名空间名称‘variable’(是否缺少using指令或程序集引用?)
我能怎么办
struct NewStruct
{
string word;
variable v;
}
试试这个。。(但仅用于测试..它是脆弱的代码:D)
我希望这不是有效的代码。是否添加了对包含枚举定义的程序集的引用?
class MainClass
{
variable myenum; //Not Enum
public static string Start(variable tmpval)
{
myenum = tmpval;
return string.Empty; //this method needs a return value
}
}