0

I want to get the property names of a C# class without instancing it, so I can compare it to the contents of a XML file.

For example, let's say that I have a class "WeatherInfo":

public class WeatherInfo
{
    public string Temperature {get; set;}
    public string Humidity {get; set;}
}

and a XML File with:

...
<Temperature>...</Temperature>
...

Now I want to write some code that checks if the properties of the class are the same as the properties of the XML-File.

In this example I want the code to return Humidity, because it is included in the class, but not in the XML-File.

Is there a way to do this?

Note: I have many classes and XML-files that I have to go through so it would be hard to instance every single class, thats why I am lookin for a better solution.

Firo
  • 30,626
  • 4
  • 55
  • 94
Kev
  • 1

0 Answers0