ITypeDefinition myClass = // get a reference to the class IMethodDefinition[] methods = myClass.Methods.ToArray(); foreach (IMethodDefinition method in methods) { Console.WriteLine(method.Name); }
ITypeDefinition myStruct = // get a reference to the struct IPropertyDefinition[] props = myStruct.Properties.ToArray(); foreach (IPropertyDefinition prop in props) { Console.WriteLine(prop.Name); }This code retrieves all properties of a struct using the ITypeDefinition interface. It could be part of a program that generates documentation for a project, listing all properties of each struct or class. Package/library: Microsoft.Cci.Metadata