51 lines
1.0 KiB
C#
51 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
//using System.Threading.Tasks;
|
|
|
|
namespace ConsoleApp1
|
|
{
|
|
class Demo{
|
|
public string Szoveg{get;set;}
|
|
public int Szam{get;set;}
|
|
|
|
public Demo(){
|
|
Szoveg = "";
|
|
Szam = -1;
|
|
}
|
|
|
|
public Demo(string szoveg, int szam){
|
|
Szoveg = szoveg;
|
|
Szam = szam;
|
|
}
|
|
}
|
|
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
var tomb = new Demo[4];
|
|
tomb[0] = new Demo("Teszt", 42);
|
|
|
|
tomb[3] = new Demo(){
|
|
Szoveg = "Masik",
|
|
Szam = 11
|
|
};
|
|
|
|
foreach (var item in tomb)
|
|
{
|
|
if (item == null){
|
|
Console.WriteLine("null");
|
|
} else{
|
|
Console.WriteLine("{0} {1}", item.Szoveg, item.Szam);
|
|
}
|
|
}
|
|
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|
|
|