IndexerReference<TOperand,TItem> 類別

定義

代表物件索引子所參考的項目,可用來做為運算式中的左值 (l-value)。

generic <typename TOperand, typename TItem>
public ref class IndexerReference sealed : System::Activities::CodeActivity<System::Activities::Location<TItem> ^>
[System.Windows.Markup.ContentProperty("Indices")]
public sealed class IndexerReference<TOperand,TItem> : System.Activities.CodeActivity<System.Activities.Location<TItem>>
[<System.Windows.Markup.ContentProperty("Indices")>]
type IndexerReference<'Operand, 'Item> = class
    inherit CodeActivity<Location<'Item>>
Public NotInheritable Class IndexerReference(Of TOperand, TItem)
Inherits CodeActivity(Of Location(Of TItem))

類型參數

TOperand

含索引子的型別。

TItem

索引子陣列的型別。

繼承
IndexerReference<TOperand,TItem>
屬性

範例

下列程式碼範例會在 IndexerReference<TOperand,TItem> 活動中使用 Assign,將整數值指派至索引 [1,2] 的物件項目,並將項目值列印至主控台。 使用會實作索引子的物件時,Assign 活動相當於下列陳述式。 myObj[1,2] = 4; .

注意

強烈建議您呼叫 IndexerReference<TOperand,TItem>,而非直接具現化 ConvertReference 左值 (l-value) 運算式活動,因為前者可以提供層級較高的抽象概念,並讓您以更直覺的方式實作工作流程。

// Define a class with a multi-dimensional indexer.  
public class ObjectWithIndexer  
{  
    private int[,] array = new int[10,10];  
    public int this[int i, int j]  
    {  
        get { return array[i,j]; }  
        set { array[i,j] = value; }  
    }  
}  

public static void IndexerReferenceSample()  
{  
    // Create a variable of type ObjectWithIndexer to store the object item.  
    var oivar = new Variable<ObjectWithIndexer>("oivar", new ObjectWithIndexer());  

    Activity myActivity = new Sequence  
    {  
        Variables = { oivar },  
        Activities =   
        {                      
            // Create an Assign activity with a reference for the object at index [1,2].  
            new Assign<int>  
            {  
                To = new IndexerReference<ObjectWithIndexer, int>  
                {  
                    Operand = oivar,  
                    Indices =  
                    {  
                        new InArgument<int>(1),  
                        new InArgument<int>(2)  
                    }  
                },  
                // Assign an integer value to the object at index [1,2].  
                Value = 4,  
            },  
            // Print the new item value to the console.  
            new WriteLine()  
            {  
                Text = ExpressionServices.Convert<string>(ctx => oivar.Get(ctx)[1, 2].ToString()),  
            }  
        }  
    };  

    // Invoke the Sequence activity.  
    WorkflowInvoker.Invoke(myActivity);  
}  

建構函式

IndexerReference<TOperand,TItem>()

初始化 IndexerReference<TOperand,TItem> 類別的新執行個體。

屬性

CacheId

取得工作流程定義範圍內的唯一快取識別碼。

(繼承來源 Activity)
Constraints

取得 Constraint 活動的集合,這些活動可以設定為提供 Activity 的驗證。

(繼承來源 Activity)
DisplayName

取得或設定選擇性的易記名稱,這個名稱會用於偵錯、驗證、例外狀況處理及追蹤。

(繼承來源 Activity)
Id

取得工作流程定義範圍內的唯一識別碼。

(繼承來源 Activity)
Implementation

不支援。

(繼承來源 CodeActivity<TResult>)
ImplementationVersion

取得或設定活動的實作版本。

(繼承來源 CodeActivity<TResult>)
Indices

取得引數集合,代表索引子陣列中項目的索引。

Operand

取得或設定包含索引子的物件。

Result

取得或設定 Activity<TResult> 的結果引數。

(繼承來源 Activity<TResult>)
ResultType

在衍生類別中實作時,取得活動 OutArgument 的型別。

(繼承來源 ActivityWithResult)

方法

CacheMetadata(ActivityMetadata)

未實作。 請改用 CacheMetadata(CodeActivityMetadata)

(繼承來源 CodeActivity<TResult>)
CacheMetadata(CodeActivityMetadata)

建立並驗證活動引數、變數、子活動和活動委派的描述。

(繼承來源 CodeActivity<TResult>)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Execute(CodeActivityContext)

在衍生類別中實作時,執行活動的執行。

(繼承來源 CodeActivity<TResult>)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

建立動態更新的對應時引發事件。

(繼承來源 CodeActivity<TResult>)
ShouldSerializeDisplayName()

指出是否應序列化 DisplayName 屬性。

(繼承來源 Activity)
ToString()

傳回包含 的 和 的 。

(繼承來源 Activity)

適用於