❔ Classes
Hello
Is the command inside for loop works??
I think no
How can I add values to the classes in array?
using System;
Class Program{
Public static void main(string[] args) {
Employee[] employees = new employees[10];
//can I make like this:
for (int i = 0;i < employees. length;i ++) {
employees[i] = new employees[i, "Name" ];
}
}
}
Public class Employee {
private int Id;
private string name;
Public Employee(int Id, string Name) {
this.Id = Id;
this.Name = Name;
}
}using System;
Class Program{
Public static void main(string[] args) {
Employee[] employees = new employees[10];
//can I make like this:
for (int i = 0;i < employees. length;i ++) {
employees[i] = new employees[i, "Name" ];
}
}
}
Public class Employee {
private int Id;
private string name;
Public Employee(int Id, string Name) {
this.Id = Id;
this.Name = Name;
}
}Is the command inside for loop works??
I think no
How can I add values to the classes in array?