ערוך

שתף באמצעות


AutoCompleteAttribute Class

Definition

Marks the attributed method as an AutoComplete object. This class cannot be inherited.

public ref class AutoCompleteAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class AutoCompleteAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type AutoCompleteAttribute = class
    inherit Attribute
Public NotInheritable Class AutoCompleteAttribute
Inherits Attribute
Inheritance
AutoCompleteAttribute
Attributes

Examples

The following code example demonstrates the use of the AutoCompleteAttribute type.

using System;
using System.EnterpriseServices;
using System.Reflection;

// References:
// System.EnterpriseServices

public class AutoCompleteAttribute_Example : ServicedComponent
{
    [AutoComplete]
    public void AutoCompleteAttribute_Ctor()
    {
    }

    [AutoComplete(true)]
    public void AutoCompleteAttribute_Ctor_Bool()
    {
    }

    [AutoComplete(false)]
    public void AutoCompleteAttribute_Value()
    {
        // Get information on the member.
        System.Reflection.MemberInfo[] memberinfo =
            this.GetType().GetMember(
            "AutoCompleteAttribute_Value");

        // Get the AutoCompleteAttribute applied to the member.
        AutoCompleteAttribute attribute =
            (AutoCompleteAttribute)System.Attribute.GetCustomAttribute(
            memberinfo[0],
            typeof(AutoCompleteAttribute),
            false);

        // Display the value of the attribute's Value property.
        Console.WriteLine("AutoCompleteAttribute.Value: {0}", attribute.Value);
    }
}
Imports System.EnterpriseServices
Imports System.Reflection


' References:
' System.EnterpriseServices

Public Class AutoCompleteAttribute_Example
    Inherits ServicedComponent
    
    <AutoComplete()>  _
    Public Sub AutoCompleteAttribute_Ctor() 
    
    End Sub

    <AutoComplete(True)>  _
    Public Sub AutoCompleteAttribute_Ctor_Bool() 
    
    End Sub

    <AutoComplete(False)>  _
    Public Sub AutoCompleteAttribute_Value() 
        ' Get information on the member.
        Dim memberinfo As System.Reflection.MemberInfo() = Me.GetType().GetMember("AutoCompleteAttribute_Value")
        
        ' Get the AutoCompleteAttribute applied to the member.
        Dim attribute As AutoCompleteAttribute = CType(System.Attribute.GetCustomAttribute(memberinfo(0), GetType(AutoCompleteAttribute), False), AutoCompleteAttribute)
        
        ' Display the value of the attribute's Value property.
        MsgBox("AutoCompleteAttribute.Value: " & attribute.Value)
    
    End Sub

End Class

Remarks

If AutoComplete is specified, it must not be disabled in the COM+ catalog; if enabled in the COM+ catalog, it must be specified on the component.

The transaction automatically calls SetComplete if the method call returns normally. If the method call throws an exception, the transaction is aborted.

Constructors

AutoCompleteAttribute()

Initializes a new instance of the AutoCompleteAttribute class, specifying that the application should automatically call SetComplete() if the transaction completes successfully.

AutoCompleteAttribute(Boolean)

Initializes a new instance of the AutoCompleteAttribute class, specifying whether COM+ AutoComplete is enabled.

Properties

TypeId

When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)
Value

Gets a value indicating the setting of the AutoComplete option in COM+.

Methods

Equals(Object)

Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode()

Returns the hash code for this instance.

(Inherited from Attribute)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

Applies to