开发者

How do I reference a list from a past console app item to another windows form item?

开发者 https://www.devze.com 2023-03-22 05:16 出处:网络
How do I reference a list from a past console app item to another windows form item? Basically, I am getting a list of email addresses from a past console app and trying to use them from that list, in

How do I reference a list from a past console app item to another windows form item? Basically, I am getting a list of email addresses from a past console app and trying to use them from that list, in a windows form for emailing people.

Here is my list code:

class MyData
{
    public string ColumnOne { get; set; }
    public string ColumnTwo { get; set; }
    public string ColumnThree { get; set; }
    public string ColumnFour { get; set; }
    public string ColumnFive { get; set; }
}

var list = new List<MyData>();
while (reader.Read())
{
    var data = new MyData
    {
        ColumnOne = reader.GetString(0),
        ColumnTwo = reader.GetString(1),
        ColumnThree = reader.GetString(2),
        ColumnFour = reader.GetString(3),
        ColumnFive = reader.GetString(4),
    };
    list.Add(data);
}

Console.WriteLine("");
foreach (var row in list)
{
    Console.WriteLine("Start Here");
    Console.WriteLine(row.ColumnOne); 
    Console.WriteLine(row.ColumnTwo); 
    Console.WriteLine(row.ColumnThree); 
    Console.Write开发者_如何学PythonLine(row.ColumnFour); // Name
    Console.WriteLine(row.ColumnFive); // Email
    Console.WriteLine(""); 
}

MassMail objForm = new MassMail(); // thats my link to my next window.


I assume you have two applications, one is a console app, and the other is a windows form app that relies on the output of the console app.

Simplest solution:

  • You can have your console app write to a file or redirect the output to a file and then make the windows form application read the contents of the file.

More complicated:

  • You can redirect the output of your console application directly into the windows form application.
0

精彩评论

暂无评论...
验证码 换一张
取 消