About the author
Given two classes, Class1 and Class2, where Class2 is inherited from Class1, and a property Prop1, reading the DeclaringType of the PropertyInfo for Prop1 and comparing it to the full class name of Class2 will help determine whether Prop1 is inherited or not. If Prop1 is inherited, the full class name will not be the same as the the full class name of Class2.
Class2 class2 = new Class2(); Type t = class2.GetType(); PropertyInfo[] pis = t.GetProperties(); string DeclaringType = pis.DeclaringType.ToString(); for (int i = 0; i < pis.Length; i++) {
PropertyInfo pi = (PropertyInfo)pis.GetValue(i); // Walk the property list string DeclaringType = pi.DeclaringType.ToString(); if (DeclaringType != t.FullName) { // pi is referencing a property that is inherited }
}
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio
Learn the command line used to compile System.pas in Delphi
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn why the map is cool in Go!