tests/runner/MIResults.cs
/// <summary>
/// Creates a new TupleValue with a subset of values from this TupleValue.
/// </summary>
/// <param name="requiredNames">The list of names that must be added to the TupleValue.</param>
/// <param name="optionalNames">The list of names that will be added to the TupleValue if they exist in this TupleValue.</param>
Creates a new TupleValue with a subset of values from this TupleValue.
Creates a new TupleValue with a subset of values from this TupleValue .
public TupleValue Subset(IEnumerable<string> requiredNames, IEnumerable<string> optionalNames = null)
        {
            List<NamedResultValue> values = new List<NamedResultValue>();
            foreach (string name in requiredNames)
            {
                values.Add(new NamedResultValue(name, this.Find(name)));
            }
            if (null != optionalNames)
            {
                foreach (string name in optionalNames)
                {
                    ResultValue value;
                    if (this.TryFind(name, out value))
                    {
                        values.Add(new NamedResultValue(name, value));
                    }
                }
            }
            return new TupleValue(values);
        }
public TupleValue Subset ( IEnumerable < string > requiredNames , IEnumerable < string > optionalNames = null ) { List < NamedResultValue > values = new List < NamedResultValue > ( ) ; foreach ( string name in requiredNames ) { values . Add ( new NamedResultValue ( name , this . Find ( name ) ) ) ; } if ( null != optionalNames ) { foreach ( string name in optionalNames ) { ResultValue value ; if ( this . TryFind ( name , out value ) ) { values . Add ( new NamedResultValue ( name , value ) ) ; } } } return new TupleValue ( values ) ; }
Creates a new TupleValue with a subset of values from this TupleValue.
Creates a new TupleValue with a subset of values from this TupleValue .
// Iterate the required list and add the values. // Will throw if a name cannot be found. // Iterate the optional list and add the values of the name exists.
requiredNames
IEnumerable<string>
The list of names that must be added to the TupleValue.
The list of names that must be added to the TupleValue .
optionalNames
IEnumerable<string>
The list of names that will be added to the TupleValue if they exist in this TupleValue.
The list of names that will be added to the TupleValue if they exist in this TupleValue .