共用方式為


RoleInstance.Role Property

 

Gets the Role object that is associated with the role instance.

Namespace:   Microsoft.WindowsAzure.ServiceRuntime
Assembly:  Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)

Syntax

public abstract Role Role { get; internal set; }
public:
property Role^ Role {
    virtual Role^ get() abstract;
    internal: virtual void set(Role^ value) abstract;
}
abstract Role : Role with get, internal set
Public MustOverride Property Role As Role
    Get
    Friend Set
End Property

Property Value

Type: Microsoft.WindowsAzure.ServiceRuntime.Role

Type: Microsoft.WindowsAzure.ServiceRuntime.Role

An instance of Role.

Remarks

The following code example shows how to retrieve the name of the role that is associated with the role instance:

foreach (var role in RoleEnvironment.Roles) 
{
   foreach (var roleInstance in role.Value.Instances)      
   {
      Trace.WriteLine("Role for the instance: " + roleInstance.Role.Name, "Information");
   }
}

See Also

RoleEnvironment
RoleInstance Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top