示例#1
0
        public bool Equals(Triplet <T> other)
        {
            EqualityComparer <T> comparer = EqualityComparer <T> .Default;

            return(comparer.Equals(First, other.First) &&
                   comparer.Equals(Second, other.Second) &&
                   comparer.Equals(Third, other.Third));
        }
示例#2
0
        public static Triplet <T> Parse(string triplet, char tokenizer)
        {
            Triplet <T> result = default(Triplet <T>);

            if (triplet.IsNotEmpty())
            {
                var tokens = triplet.Split(tokenizer);

                Guard.AgainstArgument("pair", tokens.Length != 2,
                                      Resources.Exceptions.Tuploids_ParseTemplate,
                                      "3",
                                      tokenizer.ToString());

                result = new Triplet <T>(
                    tokens[0].Parse <T>(),
                    tokens[1].Parse <T>(),
                    tokens[2].Parse <T>());
            }
            return(result);
        }