小编Ale*_*lex的帖子

如何从控制台应用程序返回List <string>?

我从Windows窗体应用程序调用控制台应用程序.我想从控制台应用程序中获取一个字符串列表.这是我的简化代码......

[STAThread]
static List<string> Main(string[] args)
{      
    List<string> returnValues = new List<string>();
    returnValues.Add("str_1");
    returnValues.Add("str_2");
    returnValues.Add("str_3");

    return returnValues;
}
Run Code Online (Sandbox Code Playgroud)

c# program-entry-point console-application

2
推荐指数
2
解决办法
2434
查看次数

How can I hold objects of different types in a collection in c#?

I want to hold objects of different types in the same collection, but am unable to solve the problem.

public class SetupStep
{
   public ObservableCollection</*Picture- or ParameterContaienr*/> Containers {get; set;}
}

public class PictureContainer
{
   public ObservableCollection<Picture> Content {get; set;}
}

public class ParameterContainer
{
   public ObservableCollection<Parameter> Content {get; set;}
}
Run Code Online (Sandbox Code Playgroud)

I think that this would be solvable via interfaces and generics, but I have not found a working solution so far. In the end, the container collection is to …

c# generics wpf interface

1
推荐指数
1
解决办法
635
查看次数