Bagikan melalui


Type.ReflectedType Properti

Definisi

Mendapatkan objek kelas yang digunakan untuk mendapatkan anggota ini.

public:
 virtual property Type ^ ReflectedType { Type ^ get(); };
public override Type? ReflectedType { get; }
public override Type ReflectedType { get; }
member this.ReflectedType : Type
Public Overrides ReadOnly Property ReflectedType As Type

Nilai Properti

Objek Type tempat objek ini Type diperoleh.

Penerapan

Contoh

Contoh ini menampilkan jenis kelas berlapis yang tercermin.

using System;
using System.Reflection;

public abstract class MyClassA
{

    public abstract class MyClassB
    {
    }

    public static void Main(string[] args)
    {
        Console.WriteLine("Reflected type of MyClassB is {0}",
            typeof(MyClassB).ReflectedType); //outputs MyClassA, the enclosing class
    }
}
module MyModule =
    type [<AbstractClass>] MyClass() = class end

    printfn $"Reflected type of MyClass is {typeof<MyClass>.ReflectedType}" // Outputs MyModule, the enclosing module.
Imports System.Reflection

Public MustInherit Class MyClassA

    Public MustInherit Class MyClassB

    End Class

    Public Shared Sub Main()
        Console.WriteLine("Reflected type of MyClassB is {0}", _
           GetType(MyClassB).ReflectedType)
    'Outputs MyClassA, the enclosing type.
    End Sub
End Class

Keterangan

Untuk Type objek, nilai properti ini selalu sama dengan nilai DeclaringType properti .

Berlaku untuk

Lihat juga