Partager via


IContentTypeRegistryService.AddContentType Method

Creates and adds a new content type.

Namespace:  Microsoft.VisualStudio.Utilities
Assembly:  Microsoft.VisualStudio.CoreUtility (in Microsoft.VisualStudio.CoreUtility.dll)

Syntax

'Déclaration
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

Parameters

Return Value

Type: Microsoft.VisualStudio.Utilities.IContentType
The IContentType.

Exceptions

Exception Condition
InvalidOperationException

typeName or one of the baseTypeNames is the name of UnknownContentType, or the content type already exists, or one of the base types would introduce a cyclic base type relationship.

ArgumentException

typeName is nulla null reference (Nothing in Visual Basic) or empty.

.NET Framework Security

See Also

Reference

IContentTypeRegistryService Interface

Microsoft.VisualStudio.Utilities Namespace