Export (0) Print
Expand All

ScriptableMemberAttribute.ScriptAlias Property

Silverlight

Gets or sets the name of a property, method, or event that is exposed to JavaScript code. By default, the script alias is the same as the name of the managed property, method, or event.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

public string ScriptAlias { get; set; }

Property Value

Type: System.String
The name of a property, method, or event.

ExceptionCondition
ArgumentException

The alias is set to an empty string.

ArgumentNullException

The alias is set to null.

You can use this property to provide an alias for a property, method, or event (PME). For example, if multiple method overloads exist on a scriptable object, you can differentiate them by providing script aliases for each overload. You can also use the ScriptAlias property to create a friendly name for a PME that has a long or confusing name.

The following example sets a ScriptAlias of "MVLN" for the method named "Method_With_a_Very_Long_Name".

public class SMT_ScriptableManagedType
    {
    [ScriptableMember]                       // No ScriptAlias is set
     public string GetString()
        { return "abcdefg"; }

     public string GetString()
        { return "abcdefg"; }

    [ScriptableMember(ScriptAlias = "MVLN")]  // ScriptAlias is set
     public string Method_With_a_Very_Long_Name
        {
        return "abcdefg";
        }
}

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft