!Adiin
!Adiin
CC#
Created by !Adiin on 5/6/2023 in #help
❔ Classes
Hello
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?
23 replies