Udostępnij za pośrednictwem


FileExtensionToContentTypeDefinition Class

Definition

Specifies a mapping between a content type and a file extension.

public ref class FileExtensionToContentTypeDefinition sealed
public ref class FileExtensionToContentTypeDefinition sealed
class FileExtensionToContentTypeDefinition sealed
public sealed class FileExtensionToContentTypeDefinition
type FileExtensionToContentTypeDefinition = class
Public NotInheritable Class FileExtensionToContentTypeDefinition
Inheritance
FileExtensionToContentTypeDefinition

Examples

internal sealed class Components
{
   [Export]
   [FileExtension(".abc")]           // Any file with the extension "abc" will get the "alphabet" content type.
   [ContentType("alphabet")]
   internal FileExtensionToContentTypeDefinition abcFileExtensionDefinition;

   [Export]
   [FileExtension(".abc.def")]       // Any file with the compound extension "abc.def" will get the "alphabet" content type.
   [ContentType("alphabet")]
   internal FileExtensionToContentTypeDefinition abcDefFileExtensionDefinition;

   [Export]
   [FileName("readme")]           // Any file named "readme" will get the "alphabet" content type.
   [ContentType("alphabet")]
   internal FileExtensionToContentTypeDefinition readmeFileNameDefinition;
   { other components }
}

Remarks

Because you cannot subclass this type, you can use the [Export] attribute with no type.

Compound extensions, such as '.abc.def' are supported via the FileExtensionAttribute, however, if there is a mapping for a compound '.abc.def' and a simple extension 'def', the one that is longer wins.

Constructors

FileExtensionToContentTypeDefinition()

Initializes a new instance of FileExtensionToContentTypeDefinition.

Applies to