我需要知道如何将数组或图像列表传递给C#中的另一个类(无所谓哪一个)。我可以创建数组或列表就好,它有我的图片,但无论我尝试通过哪一个我得到错误“方法的类型参数”'AppLayer.SymbolSetSetup.AddSymbolSet(string,System.Collections.Generic .List)'“不能从usage.thread明确指定类型参数。”传递数组或图像列表C#
我得到这两个错误,当我运行它“错误CS1502:最好的重载方法匹配'AppLayer.SymbolSetSetup.AddSymbolSet(字符串,System.Collections.Generic.List)'有一些无效的参数”和“错误CS1503 :参数2:不能从'System.Collections.Generic.List'转换为'System.Collections.Generic.List'“
不知道它是否重要,但它从WPF项目传递到C#类项目。
private void saveDeckButton_Click(object sender, RoutedEventArgs e)
{
AppLayer.SymbolSetSetup ss = new AppLayer.SymbolSetSetup();
// get all images in image dock
int count = imageWrapPanel1.Children.Count;
Image[] imArray = new Image[count];
List<Image> list = new List<Image>();
for (int i = 0; i < count; i++)
{
// get image from button
Button source = (Button)imageWrapPanel1.Children[i];
Image content = source.Content as Image;
imArray[i] = content;
list.Add(content);
}
ss.AddSymbolSet(symbolSetNameTextBox.Text, list);
}
public class SymbolSetSetup : ServerStartup
{
public void AddSymbolSet(string symbolSetName, List<Image> list)
{...
无法看到此类错误可能来自的行 - 也许您可以告诉我们编译器在哪一行中抱怨(如果您还没有从错误中丢弃方法名称,这会有所帮助) – Carsten 2012-03-26 08:04:17
您能否请您复制并粘贴完整的确切错误消息和堆栈跟踪? – 2012-03-26 08:11:13
对不起,我添加了运行时得到的错误。 – Coomikaze 2012-03-26 08:14:46