C# 如何使用构造函数初始化包含数组的对象列表

C# 如何使用构造函数初始化包含数组的对象列表,c#,arrays,constructor,C#,Arrays,Constructor,现在,我使用这个命令初始化一个对象列表,效果很好 public class RelatedBlog { public string trekid { get; set; } public string imagepath { get; set; } public RelatedBlog(string trekid, string imagepath) { this.trekid = trekid; this.imagepath =

现在,我使用这个命令初始化一个对象列表,效果很好

public class RelatedBlog
{
    public string trekid { get; set; }
    public string imagepath { get; set; }

    public RelatedBlog(string trekid, string imagepath)
    {
        this.trekid = trekid;
        this.imagepath = imagepath;          
    }
}

trek.relatedblog = new List<RelatedBlog>            
{
   new RelatedBlog("trekid", "../Images/image.jpg"),         
};
公共类相关博客
{
公共字符串trekid{get;set;}
公共字符串imagepath{get;set;}
公共关系博客(string trekid、string imagepath)
{
this.trekid=trekid;
this.imagepath=imagepath;
}
}
trek.relatedblog=新列表
{
新的相关博客(“trekid”,。/Images/image.jpg”),
};
但是,最近我决定不使用单个字符串作为第一个属性,而是使用多个字符串的数组,大小最多为4(但也可以固定,并且可以在初始化期间输入null)。这是我正在使用的代码,但它不起作用,它需要更多的“(“当我调用构造函数时

public class RelatedBlog
{
    public string[] trekid { get; set; }
    public string imagepath { get; set; }

    public RelatedBlog(string[] trekid, string imagepath)
    {
        this.trekid = trekid;
        this.imagepath = imagepath;          
    }
} 

trek.relatedblog = new List<RelatedBlog>            
{
   new RelatedBlog({"string1", "string2"}, "../Images/image.jpg"),         
};
公共类相关博客
{
公共字符串[]trekid{get;set;}
公共字符串imagepath{get;set;}
公共关系博客(string[]trekid,string imagepath)
{
this.trekid=trekid;
this.imagepath=imagepath;
}
} 
trek.relatedblog=新列表
{
新的RelatedBlog({“string1”,“string2”},../Images/image.jpg”),
};
有人能告诉我哪里出错以及如何正确初始化此列表吗。非常感谢使用:

trek.relatedblog = new List<RelatedBlog>
{
    new RelatedBlog(new[] {"string1", "string2"}, "../Images/image.jpg")
};
等于

var arr2 = new string [] { "hello", "world" };
使用:

等于

var arr2 = new string [] { "hello", "world" };
关于
新列表()
?关于
新列表()