MustRunInClientContextAttribute Sınıf

Tanım

Mümkünse, öznitelikli nesneyi oluşturucu bağlamında oluşturulmaya zorlar. Bu sınıf devralınamaz.

public ref class MustRunInClientContextAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class MustRunInClientContextAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type MustRunInClientContextAttribute = class
    inherit Attribute
Public NotInheritable Class MustRunInClientContextAttribute
Inherits Attribute
Devralma
MustRunInClientContextAttribute
Öznitelikler

Örnekler

Aşağıdaki kod örneği, türün MustRunInClientContextAttribute kullanımını gösterir.

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

// References:
// System.EnterpriseServices

[MustRunInClientContext]
public class MustRunInClientContextAttribute_Ctor : ServicedComponent
{
}

[MustRunInClientContext(false)]
public class MustRunInClientContextAttribute_Ctor_Bool : ServicedComponent
{
}

[MustRunInClientContext(false)]
public class MustRunInClientContextAttribute_Value : ServicedComponent
{
    public void ValueExample()
    {
        // Get the MustRunInClientContextAttribute applied to the class.
        MustRunInClientContextAttribute attribute =
            (MustRunInClientContextAttribute)Attribute.GetCustomAttribute(
            this.GetType(),
            typeof(MustRunInClientContextAttribute),
            false);

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


' References:
' System.EnterpriseServices

<MustRunInClientContext()>  _
Public Class MustRunInClientContextAttribute_Ctor
    Inherits ServicedComponent
End Class

<MustRunInClientContext(False)>  _
Public Class MustRunInClientContextAttribute_Ctor_Bool
    Inherits ServicedComponent
End Class

<MustRunInClientContext(False)>  _
Public Class MustRunInClientContextAttribute_Value
    Inherits ServicedComponent
    
    Public Sub ValueExample() 
        ' Get the MustRunInClientContextAttribute applied to the class.
        Dim attribute As MustRunInClientContextAttribute = CType(Attribute.GetCustomAttribute(Me.GetType(), GetType(MustRunInClientContextAttribute), False), MustRunInClientContextAttribute)
        
        ' Display the value of the attribute's Value property.
        MsgBox("MustRunInClientContextAttribute.Value: " & attribute.Value)
    
    End Sub
End Class

Açıklamalar

Öznitelikli nesnenin bağlam öznitelikleri oluşturucunun bağlamıyla çakışıyorsa, System.Runtime.InteropServices.COMException nesneyi oluşturma girişiminde bulunulduğunda bir oluşturulur.

Öznitelikleri kullanma hakkında daha fazla bilgi için bkz . Öznitelikler.

Oluşturucular

MustRunInClientContextAttribute()

sınıfının yeni bir örneğini MustRunInClientContextAttribute başlatır ve oluşturucu bağlamında nesnenin oluşturulmasını zorunlu kılarak.

MustRunInClientContextAttribute(Boolean)

sınıfının yeni bir örneğini MustRunInClientContextAttribute başlatır, isteğe bağlı olarak nesneyi oluşturucu bağlamında oluşturmaz.

Özellikler

TypeId

Türetilmiş bir sınıfta uygulandığında, bu Attributeiçin benzersiz bir tanımlayıcı alır.

(Devralındığı yer: Attribute)
Value

Öznitelikli nesnenin oluşturucu bağlamında oluşturulup oluşturulmayacağını gösteren bir değer alır.

Yöntemler

Equals(Object)

Bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değeri döndürür.

(Devralındığı yer: Attribute)
GetHashCode()

Bu örneğe ilişkin karma kodu döndürür.

(Devralındığı yer: Attribute)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
IsDefaultAttribute()

Türetilmiş bir sınıfta geçersiz kılındığında, bu örneğin değerinin türetilmiş sınıf için varsayılan değer olup olmadığını gösterir.

(Devralındığı yer: Attribute)
Match(Object)

Türetilmiş bir sınıfta geçersiz kılındığında, bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değer döndürür.

(Devralındığı yer: Attribute)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

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

Bir ad kümesini karşılık gelen bir dağıtma tanımlayıcısı kümesine eşler.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Bir arabirimin tür bilgilerini almak için kullanılabilecek bir nesnenin tür bilgilerini alır.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Bir nesnenin sağladığı tür bilgisi arabirimlerinin sayısını alır (0 ya da 1).

(Devralındığı yer: Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Bir nesne tarafından sunulan özelliklere ve yöntemlere erişim sağlar.

(Devralındığı yer: Attribute)

Şunlara uygulanır