Trouble with reflection

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.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top