- Joined
- Jul 7, 2023
- Messages
- 4
- Reaction score
- 0
Guys, I need your help. I need to solve the following in C#:
first part of the task: Using reflection, you need to examine the properties of the .NET String class. It is necessary to display the name of the class, its namespace, the name of the assembly it is in, the type it inherits, the interfaces it implements, as well as basic information about whether the class is abstract, sealed, generic, etc.
Second part of the task: the following class is given:
class Country
{
public string Name { get; set; }
public int Population { get; set; }
public Country(string name, int population)
{
Name = name;
Population = population;
}
public string GetCountryInfo()
{
return $'Country {Name} has the population of {Population}.';
}
}
Place the displayed class inside a new Visual Studio console project. Inside the program's Main method, use reflection to dynamically create an instance of the Country class, and then dynamically call the GetCountryInfo method. Display the obtained result inside the console.
Thanks. I'd be very happy, if someone can help.
first part of the task: Using reflection, you need to examine the properties of the .NET String class. It is necessary to display the name of the class, its namespace, the name of the assembly it is in, the type it inherits, the interfaces it implements, as well as basic information about whether the class is abstract, sealed, generic, etc.
Second part of the task: the following class is given:
class Country
{
public string Name { get; set; }
public int Population { get; set; }
public Country(string name, int population)
{
Name = name;
Population = population;
}
public string GetCountryInfo()
{
return $'Country {Name} has the population of {Population}.';
}
}
Place the displayed class inside a new Visual Studio console project. Inside the program's Main method, use reflection to dynamically create an instance of the Country class, and then dynamically call the GetCountryInfo method. Display the obtained result inside the console.
Thanks. I'd be very happy, if someone can help.
Last edited: