Class MutableTuple
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Represents a MutableTuple with an empty value.
public class MutableTuple
- Inheritance
-
MutableTuple
- Derived
Examples
The following example demonstrates how to create and use MutableTuple and its generic variants to store and pass multiple values without creating a custom class.
using System;
using Cuemon;
namespace Contoso.Workflow;
public sealed class MutableTupleExample
{
public static void Run()
{
MutableTuple empty = new MutableTuple();
var pair = new MutableTuple<string, int>("Alice", 30);
pair.Arg2 = 31;
object[] values = pair.ToArray("verified");
var clone = (MutableTuple<string, int>)pair.Clone();
Console.WriteLine($"Empty: {empty.IsEmpty}");
Console.WriteLine($"{clone.Arg1}:{clone.Arg2}");
Console.WriteLine($"Array length: {values.Length}");
}
}
Constructors
MutableTuple()
Initializes a new instance of the MutableTuple class.
public MutableTuple()
Properties
IsEmpty
Gets a value indicating whether this MutableTuple is empty.
public virtual bool IsEmpty { get; }
Property Value
- bool
trueif this MutableTuple is empty; otherwise,false.
Methods
Clone()
Creates a shallow copy of the current MutableTuple object.
public virtual MutableTuple Clone()
Returns
- MutableTuple
A new MutableTuple that is a copy of this instance.
Remarks
When thread safety is required this is the method to invoke.
ToArray()
Returns an array of objects that represent the arguments passed to this instance.
public virtual object[] ToArray()
Returns
- object[]
An array of objects that represent the arguments passed to this instance. Returns an empty array if the current instance was constructed with no generic arguments.
ToArray(params object[])
Returns an array of objects that represent the arguments passed to this instance concatenated with the specified additionalArgs.
public object[] ToArray(params object[] additionalArgs)
Parameters
additionalArgsobject[]The additional arguments to concatenate with the objects that represent the arguments passed to this instance.
Returns
- object[]
An array of objects that represent the arguments passed to this instance concatenated with the specified
additionalArgs.
ToString()
Returns a string that represents this instance.
public override string ToString()