Freezable.CreateInstanceCore Freezable.CreateInstanceCore Freezable.CreateInstanceCore Freezable.CreateInstanceCore Method

定义

在派生类中实现时,创建 Freezable 派生类的新实例。When implemented in a derived class, creates a new instance of the Freezable derived class.

protected:
 abstract System::Windows::Freezable ^ CreateInstanceCore();
protected abstract System.Windows.Freezable CreateInstanceCore ();
abstract member CreateInstanceCore : unit -> System.Windows.Freezable
Protected MustOverride Function CreateInstanceCore () As Freezable

返回

新实例。The new instance.

示例

下面的示例演示的CreateInstanceCore典型实现。The following example shows a typical implementation of CreateInstanceCore.

public class MyFreezable : Freezable
{
    // Typical implementation of CreateInstanceCore
    protected override Freezable CreateInstanceCore()
    {
    
        return new MyFreezable();      
    }


    // ...
    // Other code for the MyFreezableClass.
    // ...
    
    
}

Public Class MyFreezable
    Inherits Freezable
    ' Typical implementation of CreateInstanceCore
    Protected Overrides Function CreateInstanceCore() As Freezable

        Return New MyFreezable()
    End Function


    ' ...
    ' Other code for the MyFreezableClass.
    ' ...


End Class

注解

请勿直接调用此方法 (在实现中调用基时除外)。Do not call this method directly (except when calling base in an implementation). 每当创建的Freezable新实例时, CreateInstance方法都会在内部调用此方法。This method is called internally by the CreateInstance method whenever a new instance of the Freezable is created.

继承者说明

Freezable个派生类必须实现此方法。Every Freezable derived class must implement this method. 典型的实现是只调用无参数的构造函数并返回结果。A typical implementation is to simply call the parameterless constructor and return the result.

适用于

另请参阅