IContentTypeRegistryService.AddContentType 方法

创建并添加新的内容类型。

命名空间:  Microsoft.VisualStudio.Utilities
程序集:  Microsoft.VisualStudio.CoreUtility(在 Microsoft.VisualStudio.CoreUtility.dll 中)

语法

声明
Function AddContentType ( _
    typeName As String, _
    baseTypeNames As IEnumerable(Of String) _
) As IContentType
IContentType AddContentType(
    string typeName,
    IEnumerable<string> baseTypeNames
)
IContentType^ AddContentType(
    String^ typeName, 
    IEnumerable<String^>^ baseTypeNames
)
abstract AddContentType : 
        typeName:string * 
        baseTypeNames:IEnumerable<string> -> IContentType
function AddContentType(
    typeName : String, 
    baseTypeNames : IEnumerable<String>
) : IContentType

参数

  • typeName
    类型:String

    内容类型的名称。

  • baseTypeNames
    类型:IEnumerable<String>

    要用作基内容类型的内容类型名称的列表。 可选。

返回值

类型:Microsoft.VisualStudio.Utilities.IContentType
IContentType

异常

异常 条件
InvalidOperationException

typeName 或一个 baseTypeNames 是 UnknownContentType的名称,或者该内容类型已经存在,或者某个基类型将引入了一个循环基础关系。

ArgumentException

typeName 为 nullnull 引用(在 Visual Basic 中为 Nothing) 或为空。

.NET Framework 安全性

请参阅

参考

IContentTypeRegistryService 接口

Microsoft.VisualStudio.Utilities 命名空间