// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; namespace Microsoft.ClearScript { ///

/// Specifies how the target type member is to be exposed to script code. This extended version /// supports additional options. /// /// /// This attribute is applicable to events, fields, methods, and properties. /// [AttributeUsage(AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property)] public sealed class ScriptMemberAttribute : ScriptUsageAttribute { /// /// Initializes a new instance. /// public ScriptMemberAttribute() { } /// /// Initializes a new instance with the specified name. /// /// The name that script code will use to access the target type member. public ScriptMemberAttribute(string name) { Name = name; } /// /// Initializes a new instance with the specified script access setting. /// /// The script access setting for the target type member. public ScriptMemberAttribute(ScriptAccess access) : base(access) { } /// /// Initializes a new instance with the specified name and script access setting. /// /// The name that script code will use to access the target type member. /// The script access setting for the target type member. public ScriptMemberAttribute(string name, ScriptAccess access) : base(access) { Name = name; } /// /// Initializes a new instance with the specified script options. /// /// The script options for the target type member. public ScriptMemberAttribute(ScriptMemberFlags flags) { Flags = flags; } /// /// Initializes a new instance with the specified name and script options. /// /// The name that script code will use to access the target type member. /// The script options for the target type member. public ScriptMemberAttribute(string name, ScriptMemberFlags flags) { Name = name; Flags = flags; } /// /// Initializes a new instance with the specified script access setting and script options. /// /// The script access setting for the target type member. /// The script options for the target type member. public ScriptMemberAttribute(ScriptAccess access, ScriptMemberFlags flags) : base(access) { Flags = flags; } /// /// Initializes a new instance with the specified name, script access setting, and script options. /// /// The name that script code will use to access the target type member. /// The script access setting for the target type member. /// The script options for the target type member. public ScriptMemberAttribute(string name, ScriptAccess access, ScriptMemberFlags flags) : base(access) { Name = name; Flags = flags; } /// /// Gets or sets the name that script code will use to access the target type member. /// /// /// The default value is the name of the target type member. Note that this property has no /// effect on the method binding algorithm. If a script-based call is bound to a method /// that is exposed under a different name, it will be rejected even if an overload exists /// that could receive the call. /// public string Name { get; set; } /// /// Gets or sets the script options for the target type member. /// public ScriptMemberFlags Flags { get; set; } } }