update MEF to preview 9
[mcs.git] / class / System.ComponentModel.Composition / src / ComponentModel / System / ComponentModel / Composition / InheritedExportAttribute.cs
blobab42dfab9ab2d2de2e1fbf1147544078834c5373
1 // -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
4 using System;
5 using System.ComponentModel.Composition.Hosting;
6 using System.Diagnostics.CodeAnalysis;
8 namespace System.ComponentModel.Composition
10 /// <summary>
11 /// Specifies that a type or interface that provides a particular export.
12 /// </summary>
13 [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
14 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
15 public class InheritedExportAttribute : ExportAttribute
17 /// <summary>
18 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
19 /// type marked with this attribute under the default contract name.
20 /// </summary>
21 /// <remarks>
22 /// <para>
23 /// The default contract name is the result of calling
24 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type itself,
25 /// that is marked with this attribute.
26 /// </para>
27 /// <para>
28 /// The contract name is compared using a case-sensitive, non-linguistic comparison
29 /// using <see cref="StringComparer.Ordinal"/>.
30 /// </para>
31 /// </remarks>
32 public InheritedExportAttribute()
33 : this((string)null, (Type)null)
37 /// <summary>
38 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
39 /// type marked with this attribute under a contract name derived from the specified type.
40 /// </summary>
41 /// <param name="contractType">
42 /// A <see cref="Type"/> of which to derive the contract name to export the type
43 /// marked with this attribute, under; or <see langword="null"/> to use the
44 /// default contract name.
45 /// </param>
46 /// <remarks>
47 /// <para>
48 /// The contract name is the result of calling
49 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
50 /// <paramref name="contractType"/>.
51 /// </para>
52 /// <para>
53 /// The default contract name is the result of calling
54 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
55 /// itself, that is marked with this attribute.
56 /// </para>
57 /// <para>
58 /// The contract name is compared using a case-sensitive, non-linguistic comparison
59 /// using <see cref="StringComparer.Ordinal"/>.
60 /// </para>
61 /// </remarks>
62 public InheritedExportAttribute(Type contractType)
63 : this((string)null, contractType)
67 /// <summary>
68 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
69 /// type or member marked with this attribute under the specified contract name.
70 /// </summary>
71 /// <param name="contractName">
72 /// A <see cref="String"/> containing the contract name to export the type
73 /// marked with this attribute, under; or <see langword="null"/> or an empty string
74 /// ("") to use the default contract name.
75 /// </param>
76 /// <remarks>
77 /// <para>
78 /// The default contract name is the result of calling
79 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
80 /// the type itself that this is marked with this attribute.
81 /// </para>
82 /// <para>
83 /// The contract name is compared using a case-sensitive, non-linguistic comparison
84 /// using <see cref="StringComparer.Ordinal"/>.
85 /// </para>
86 /// </remarks>
87 public InheritedExportAttribute(string contractName)
88 : this(contractName, (Type)null)
92 /// <summary>
93 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
94 /// type or member marked with this attribute under the specified contract name.
95 /// </summary>
96 /// <param name="contractName">
97 /// A <see cref="String"/> containing the contract name to export the type
98 /// marked with this attribute, under; or <see langword="null"/> or an empty string
99 /// ("") to use the default contract name.
100 /// </param>
101 /// <param name="contractType">
102 /// A <see cref="Type"/> of which to derive the contract name to export the type
103 /// marked with this attribute, under; or <see langword="null"/> to use the
104 /// default contract name.
105 /// </param>
106 /// <remarks>
107 /// <para>
108 /// The default contract name is the result of calling
109 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
110 /// the type itself that this is marked with this attribute.
111 /// </para>
112 /// <para>
113 /// The contract name is compared using a case-sensitive, non-linguistic comparison
114 /// using <see cref="StringComparer.Ordinal"/>.
115 /// </para>
116 /// </remarks>
117 public InheritedExportAttribute(string contractName, Type contractType)
118 : base(contractName, contractType)