Beispiel #1
0
        /// <summary>
        /// 解析多元组
        /// </summary>
        /// <typeparam name="TItem"></typeparam>
        /// <param name="valueNum"></param>
        /// <param name="parse"></param>
        /// <param name="sprartor">默认值" "</param>
        /// <returns></returns>
        protected Func <string, TItem> ParseValueGroup <TItem>(uint valueNum, Action <TItem, int[]> parse, string sprartor)
            where TItem : new()
        {
            Func <string, TItem> p = s =>
            {
                string[] strArr = s.Split(new[] { sprartor }, StringSplitOptions.None);
                int[]    intArr = new int[valueNum];

                for (int i = 0; i < strArr.Length; i++)
                {
                    StrHelper.GetI32(strArr[i], out intArr[i]);
                }

                TItem item = new TItem();
                parse(item, intArr);
                return(item);
            };

            return(p);
        }