Switch<T>.Cases Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the dictionary of potential execution paths. Each entry contains a key and an activity that is executed when the result of the expression matches the key.
public:
property System::Collections::Generic::IDictionary<T, System::Activities::Activity ^> ^ Cases { System::Collections::Generic::IDictionary<T, System::Activities::Activity ^> ^ get(); };
public System.Collections.Generic.IDictionary<T,System.Activities.Activity> Cases { get; }
member this.Cases : System.Collections.Generic.IDictionary<'T, System.Activities.Activity>
Public ReadOnly Property Cases As IDictionary(Of T, Activity)
Property Value
The execution paths.
Examples
The following code sample demonstrates setting the Cases property of a Switch<T> activity.
// check if the number is ok...
new Switch<int>()
{
DisplayName = "Verify Value from User",
Expression = ExpressionServices.Convert<int>( env => numberFromUser.Get(env).CompareTo(numberToGuess.Get(env)) ),
Cases =
{
{ 0, new Assign<bool>()
{
To = new OutArgument<bool>(finished),
Value = true
}
},
{ 1, new WriteLine() { Text = " Try a lower number number..." } },
{ -1, new WriteLine() { Text = " Try a higher number" } }
}
}
Remarks
When the activity executes, the case that is executed is the first case whose key matches the Expression property.
Applies to
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.