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 }
}
Continued discussion of undocumented Delphi 8 Property Access Specifiers, and other ways of adding and removing delegates / events handlers, including clearing the list of all the delegates / event handlers.
This article discusses the new Delphi 8 property access specifiers.
A method pointer is now the same as a global procedure, ie, procedure of object = procedure.