I need to know what is difference between
"IsGenericType", "IsConstructedGenericType" and "IsNested" properties?
My goal was to get all those object properties which have their own many properties...
Maybe object property is simple number, maybe it is a string.
But what if object property is another object with a lot of properties?
I was working for: How to get first object properties which are objects with a lot of properties.
var shellFile1 = ShellFile.FromParsingName(PathOfanyFile);
PropertyInfo[] P1 = shellFile1.Properties.System.GetType().GetProperties();
var t1 = shellFile1.Properties.System;
for (int i = 0; i < P1.Count(); i++)
{
var t2 = t1.GetType().GetProperty(P1[i].Name).GetValue(t1, null);
if (t2.GetType().IsGenericType)
{
textBox1.Text += i + 1 + " " + P1[i].Name + "\r\n";
}
else
{
textBox2.Text += i + 1 + " " + P1[i].Name + "\r\n";
}
}
In my code if you replace one line :
if (t2.GetType().IsGenericType)
by another line
if (t2.GetType().IsConstructedGenericType)
or using another line
if (!t2.GetType().IsNested)
then you will get the exact same result!
As I mentioned: "IsGenericType" and "IsConstructedGenericType" property gives the same result as inverse of "IsNested" property!
Is it true?
Is it always like right now?
Which one should I use to get constructed object properties?