|
Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. Más información.
|
Traducción
Original
|
ExportAttribute (Clase)
System.Attribute
System.ComponentModel.Composition.ExportAttribute
System.ComponentModel.Composition.InheritedExportAttribute
Espacio de nombres: System.ComponentModel.Composition
Ensamblado: System.ComponentModel.Composition (en System.ComponentModel.Composition.dll)
El tipo ExportAttribute expone los siguientes miembros.
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | ExportAttribute() | |
![]() ![]() | ExportAttribute(String) | |
![]() ![]() | ExportAttribute(Type) | |
![]() ![]() | ExportAttribute(String, Type) |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | ContractName | |
![]() ![]() | ContractType | |
![]() | TypeId |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | Equals | Infraestructura. |
![]() ![]() | Finalize | |
![]() ![]() | GetHashCode | |
![]() ![]() | GetType | |
![]() | IsDefaultAttribute | |
![]() | Match | |
![]() ![]() | MemberwiseClone | |
![]() ![]() | ToString |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | _Attribute.GetIDsOfNames | |
![]() ![]() | _Attribute.GetTypeInfo | |
![]() ![]() | _Attribute.GetTypeInfoCount | Recupera el número de interfaces de tipo de información que suministra un objeto (0 ó 1) |
![]() ![]() | _Attribute.Invoke |
//Default export infers type and contract name from the //exported type. This is the preferred method. [Export] public class MyExport1 { public String data = "Test Data 1."; } public class MyImporter1 { [Import] public MyExport1 importedMember { get; set; } } public interface MyInterface { } //Specifying the contract type may be important if //you want to export a type other then the base type, //such as an interface. [Export(typeof(MyInterface))] public class MyExport2 : MyInterface { public String data = "Test Data 2."; } public class MyImporter2 { //The import must match the contract type! [Import(typeof(MyInterface))] public MyExport2 importedMember { get; set; } } //Specifying a contract name should only be //needed in rare caes. Usually, using metadata //is a better approach. [Export("MyContractName", typeof(MyInterface))] public class MyExport3 : MyInterface { public String data = "Test Data 3."; } public class MyImporter3 { //Both contract name and type must match! [Import("MyContractName", typeof(MyInterface))] public MyExport3 importedMember { get; set; } } class Program { static void Main(string[] args) { AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(typeof(MyExport1).Assembly)); CompositionContainer _container = new CompositionContainer(catalog); MyImporter1 test1 = new MyImporter1(); MyImporter2 test2 = new MyImporter2(); MyImporter3 test3 = new MyImporter3(); _container.SatisfyImportsOnce(test1); _container.SatisfyImportsOnce(test2); _container.SatisfyImportsOnce(test3); Console.WriteLine(test1.importedMember.data); Console.WriteLine(test2.importedMember.data); Console.WriteLine(test3.importedMember.data); Console.ReadLine(); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (no se admite el rol Server Core), Windows Server 2008 R2 (se admite el rol Server Core con SP1 o versiones posteriores; no se admite Itanium)
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

