예제 #1
0
        /// <summary>
        /// Gets the first match capture from the specified match.
        /// </summary>
        /// <param name="c">The g.</param>
        /// <param name="predicate">The predicate.</param>
        /// <returns></returns>
        /// <exception cref="System.InvalidOperationException"></exception>
        public static Capture Single(this CaptureCollection c, Func <Capture, bool> predicate)
        {
            var result = c.SingleOrDefault(x => predicate(x));

            if (result == default(Capture))
            {
                throw new InvalidOperationException(Resources.Sequence_Empty);
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Gets the first match capture from the specified match.
        /// </summary>
        /// <param name="c">The capture collection.</param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public static Capture Single(this CaptureCollection c)
        {
            var result = c.SingleOrDefault(x => true);

            if (result == default(Capture))
            {
                throw new InvalidOperationException(Resources.Sequence_Empty);
            }
            return(result);
        }
예제 #3
0
 /// <summary>
 /// Gets the first match capture from the specified match.
 /// </summary>
 /// <param name="c">The g.</param>
 /// <returns></returns>
 public static Capture SingleOrDefault(this CaptureCollection c)
 {
     return(c.SingleOrDefault(x => true));
 }