C# 队列中的结构

C# 队列中的结构,c#,C#,我有一个如下所示的结构: struct Add { public static string url; public static string password; public static string fake_path; public static List<string> upload = new List<string>(); } struct-Add { 公共静态字符串url; 公共静态字符串密码; 公共静态字符串伪路径;

我有一个如下所示的结构:

struct Add
{
    public static string url;
    public static string password;
    public static string fake_path;
    public static List<string> upload = new List<string>();
}
struct-Add
{
公共静态字符串url;
公共静态字符串密码;
公共静态字符串伪路径;
公共静态列表上传=新建列表();
}
从表格中我填写了所有这些VAR。然后我需要将这个结构添加到队列中。怎么做?

试试这个

System.Collections.Generic.Queue<Add> queue = new System.Collections.Generic.Queue<Add>();
// queue.Enqueue(new Add(...));
System.Collections.Generic.Queue Queue=new System.Collections.Generic.Queue();
//排队(新添加(…);

为什么所有字段都是静态的?它们不属于实例吗?如果只有静态成员,请不要使用
struct
;改用
静态类
。但我想你的字段应该是非静态的。在
struct
中,非静态字段(实例字段)不能有字段初始值设定项,就像
upload
有一样。也许您想要一个非静态的
?您的类型(结构/类)是可变的吗?