Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / mscorlib / system / runtime / interopservices / windowsruntime / attributes.cs
blob8dfd4c70ca51fbb43d406452d07eec120d36065a
1 // ==++==
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // ==--==
6 //
7 // <OWNER>Microsoft</OWNER>
8 // <OWNER>Microsoft</OWNER>
9 // <OWNER>Microsoft</OWNER>
11 using System;
13 namespace System.Runtime.InteropServices.WindowsRuntime
15 // DefaultInterfaceAttribute marks a WinRT class (or interface group) that has its default interface specified.
16 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
17 public sealed class DefaultInterfaceAttribute : Attribute
19 private Type m_defaultInterface;
21 public DefaultInterfaceAttribute(Type defaultInterface)
23 m_defaultInterface = defaultInterface;
26 public Type DefaultInterface
28 get { return m_defaultInterface; }
32 // WindowsRuntimeImport is a pseudo custom attribute which causes us to emit the tdWindowsRuntime bit
33 // onto types which are decorated with the attribute. This is needed to mark Windows Runtime types
34 // which are redefined in mscorlib.dll and System.Runtime.WindowsRuntime.dll, as the C# compiler does
35 // not have a built in syntax to mark tdWindowsRuntime. These two assemblies are special as they
36 // implement the CLR's support for WinRT, so this type is internal as marking tdWindowsRuntime should
37 // generally be done via winmdexp for user code.
38 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)]
39 [System.Runtime.CompilerServices.FriendAccessAllowed]
40 internal sealed class WindowsRuntimeImportAttribute : Attribute
42 public WindowsRuntimeImportAttribute()
43 { }
46 // This attribute is applied to class interfaces in a generated projection assembly. It is used by Visual Studio
47 // and other tools to find out what version of a component (eg. Windows) a WinRT class began to implement
48 // a particular interfaces.
49 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false, AllowMultiple = true)]
50 public sealed class InterfaceImplementedInVersionAttribute : Attribute
52 public InterfaceImplementedInVersionAttribute(Type interfaceType, byte majorVersion, byte minorVersion, byte buildVersion, byte revisionVersion)
54 m_interfaceType = interfaceType;
55 m_majorVersion = majorVersion;
56 m_minorVersion = minorVersion;
57 m_buildVersion = buildVersion;
58 m_revisionVersion = revisionVersion;
61 public Type InterfaceType
63 get { return m_interfaceType; }
66 public byte MajorVersion
68 get { return m_majorVersion; }
71 public byte MinorVersion
73 get { return m_minorVersion; }
76 public byte BuildVersion
78 get { return m_buildVersion; }
81 public byte RevisionVersion
83 get { return m_revisionVersion; }
86 private Type m_interfaceType;
87 private byte m_majorVersion;
88 private byte m_minorVersion;
89 private byte m_buildVersion;
90 private byte m_revisionVersion;
93 // Applies to read-only array parameters
94 [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
95 public sealed class ReadOnlyArrayAttribute : Attribute
97 public ReadOnlyArrayAttribute() {}
100 // Applies to write-only array parameters
101 [AttributeUsage(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
102 public sealed class WriteOnlyArrayAttribute : Attribute
104 public WriteOnlyArrayAttribute() {}
109 // This attribute is applied on the return value to specify the name of the return value.
110 // In WindowsRuntime all parameters including return value need to have unique names.
111 // This is essential in JS as one of the ways to get at the results of a method in JavaScript is via a Dictionary object keyed by parameter name.
112 [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
113 public sealed class ReturnValueNameAttribute : Attribute
115 private string m_Name;
116 public ReturnValueNameAttribute(string name)
118 m_Name = name;
121 public string Name
123 get { return m_Name; }