I want to include the _main.session (along with the entry) in foreach .... how can I do this?
Yes, just use the Union
method (it is in the System.Linq namespace) as long as the two collections are of the same type
foreach (var item in _main.entrada.Union(_main.saida))
{
...
}
Complete example:
public class MainCollection
{
public int[] entrada;
public int[] saida;
public MainCollection()
{
entrada = new int[] { 1, 2, 3 };
saida = new int[] { 4, 5, 6 };
}
}
public class Program
{
private static MainCollection _main = new MainCollection();
public static void Main()
{
foreach (var item in _main.entrada.Union(_main.saida))
{
Console.WriteLine(item);
}
Console.ReadKey();
return;
}
}