PackagePart.GetContentTypeCore 方法

定义

在派生类中重写时,返回部件内容的 MIME 类型。

protected:
 virtual System::String ^ GetContentTypeCore();
protected virtual string GetContentTypeCore ();
abstract member GetContentTypeCore : unit -> string
override this.GetContentTypeCore : unit -> string
Protected Overridable Function GetContentTypeCore () As String

返回

String

部件内容的 MIME 类型。

例外

派生类不为 GetContentTypeCore() 方法提供所需的重写实现。

注解

GetContentTypeCore 是抽象基类的 PackagePart 虚拟方法。 仅在构造时无法提供内容类型的值的派生类型中实现此方法,或者计算内容类型值是非琐碎操作或成本高昂的操作。 返回值必须是有效的 MIME 内容类型。

派生类可以调用 GetContentTypeCore 以将派生类的属性初始化 ContentType 为默认值。 设置 ContentType 属性后,无法更改该属性。

适用于