TypeExtensionsGetAllBaseTypes Method
Gets the Type inheritance hierarchy of the the source Type, that is,
the type from which the source Type directly inherits, and the types from which their inherited types inherits.
Namespace: DevCase.Extensions.TypeExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static IEnumerable<Type> GetAllBaseTypes(
this Type type
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function GetAllBaseTypes (
type As Type
) As IEnumerable(Of Type)
Dim type As Type
Dim returnValue As IEnumerable(Of Type)
returnValue = type.GetAllBaseTypes()
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static IEnumerable<Type^>^ GetAllBaseTypes(
Type^ type
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member GetAllBaseTypes :
type : Type -> IEnumerable<Type>
No code example is currently available or this language may not be supported.
- type Type
-
The source Type.
IEnumerableType
The type from which the source
Type directly inherits, and the types from which the inherited types inherits;
or
if the source
Type represents the
Object class or an interface.
In Visual Basic and C#, you can call this method as an instance method on any object of type
Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim mainType As Type = GetType(Form)
Dim types As IEnumerable(Of Type) = GetAllBaseTypes(mainType)
Dim sb As New StringBuilder()
sb.AppendLine($"Type inheritance hierarchy of '{mainType.FullName}':")
sb.AppendLine()
For i As Integer = 0 To (types.Count - 1)
sb.AppendLine($"{String.Concat(Enumerable.Repeat(" "c, (i * 4)))}{types(i).FullName}")
Next i
Console.WriteLine(sb.ToString())
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.