private CustomerType customerType;
public Customer(string name, string adress, float amount)
this.customerType = CustomerType.Corporate;
public CustomerType CustomerType
this.customerType = value;
public override string ToString()
return String.Format("Имя: {0}, адресс: {1}, сумма: {2}, тип: {3}", this.name, this.adress, this.amount, this.customerType);
public static void ShowCustomersByType(Customer[] customers, CustomerType customerType)
for (int i = 0; i < customers.Length; i++)
if (customers[i].CustomerType == customerType)
Console.WriteLine(customers[i]);
public static void Main()
Customer customer1 = new Customer();
Customer customer2 = new Customer("Name", "Adress", 223.4F);
Console.WriteLine(customer1);
customer1.Adress = "sserdA";
customer1.Amount = 132.3F;
customer1.Amount = -132.3F;
Console.WriteLine(customer1);
Console.WriteLine(customer2);
customer2.CustomerType = CustomerType.Individual;
Customer[] customers = new Customer[]{customer1,
new Customer("Donnie Brasco", "Jump Street 21", 214.4F),
new Customer("Joe Pistone", "Some Street 24", 421.3F)};
ShowCustomersByType(customers, CustomerType.Individual);
ShowCustomersByType(customers, CustomerType.Corporate);