EnumerateFirstElement() public static method

Returns the first element in the supplied enumerable.
/// If the supplied did not have any elements. /// /// If the supplied is . ///
public static EnumerateFirstElement ( IEnumerable enumerable ) : object
enumerable IEnumerable /// The to use to enumerate /// elements. ///
return object
コード例 #1
0
        public void EnumerateFirstElement()
        {
            string      expected   = "Hiya";
            IList       list       = new string[] { expected, "Aw!", "Man!" };
            IEnumerator enumerator = list.GetEnumerator();
            object      actual     = ObjectUtils.EnumerateFirstElement(enumerator);

            Assert.AreEqual(expected, actual);
        }