当前位置: 首页>>代码示例>>C#>>正文


C# TimeSpanResult.Init方法代码示例

本文整理汇总了C#中TimeSpanResult.Init方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSpanResult.Init方法的具体用法?C# TimeSpanResult.Init怎么用?C# TimeSpanResult.Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeSpanResult的用法示例。


在下文中一共展示了TimeSpanResult.Init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseExactMultiple

 internal static TimeSpan ParseExactMultiple(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles)
 {
     TimeSpanResult result = new TimeSpanResult();
     result.Init(TimeSpanThrowStyle.All);
     if (!TryParseExactMultipleTimeSpan(input, formats, formatProvider, styles, ref result))
     {
         throw result.GetTimeSpanParseException();
     }
     return result.parsedTimeSpan;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:TimeSpanParse.cs

示例2: Parse

 internal static TimeSpan Parse(string input, IFormatProvider formatProvider)
 {
     TimeSpanResult result = new TimeSpanResult();
     result.Init(TimeSpanThrowStyle.All);
     if (!TryParseTimeSpan(input, TimeSpanStandardStyles.Any, formatProvider, ref result))
     {
         throw result.GetTimeSpanParseException();
     }
     return result.parsedTimeSpan;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:TimeSpanParse.cs

示例3: TryParseExactMultiple

        internal static Boolean TryParseExactMultiple(String input, String[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result) {
            TimeSpanResult parseResult = new TimeSpanResult();
            parseResult.Init(TimeSpanThrowStyle.None);

            if (TryParseExactMultipleTimeSpan(input, formats, formatProvider, styles, ref parseResult)) {
                result = parseResult.parsedTimeSpan;
                return true;
            }
            else {
                result = default(TimeSpan);
                return false;
            }
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:13,代码来源:TimeSpanParse.cs

示例4: ParseExactMultiple

        internal static TimeSpan ParseExactMultiple(String input, String[] formats, IFormatProvider formatProvider, TimeSpanStyles styles) {
            TimeSpanResult parseResult = new TimeSpanResult();
            parseResult.Init(TimeSpanThrowStyle.All);

            if (TryParseExactMultipleTimeSpan(input, formats, formatProvider, styles, ref parseResult)) {
                return parseResult.parsedTimeSpan;
            }
            else {
                throw parseResult.GetTimeSpanParseException();
            }
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:11,代码来源:TimeSpanParse.cs

示例5: TryParse

        internal static Boolean TryParse(String input, IFormatProvider formatProvider, out TimeSpan result) {
            TimeSpanResult parseResult = new TimeSpanResult();
            parseResult.Init(TimeSpanThrowStyle.None);

            if (TryParseTimeSpan(input, TimeSpanStandardStyles.Any, formatProvider, ref parseResult)) {
                result = parseResult.parsedTimeSpan;
                return true;
            }
            else {
                result = default(TimeSpan);
                return false;
            }
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:13,代码来源:TimeSpanParse.cs

示例6: Parse

        // ---- SECTION:  internal static methods called by System.TimeSpan ---------*
        //
        //  [Try]Parse, [Try]ParseExact, and [Try]ParseExactMultiple
        //
        //  Actions: Main methods called from TimeSpan.Parse
        #region ParseMethods
        internal static TimeSpan Parse(String input, IFormatProvider formatProvider) {
            TimeSpanResult parseResult = new TimeSpanResult();
            parseResult.Init(TimeSpanThrowStyle.All);

            if (TryParseTimeSpan(input, TimeSpanStandardStyles.Any, formatProvider, ref parseResult)) {
                return parseResult.parsedTimeSpan;
            }
            else {
                throw parseResult.GetTimeSpanParseException();
            }
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:17,代码来源:TimeSpanParse.cs

示例7: TryParseExactMultipleTimeSpan

        //
        //  TryParseExactMultipleTimeSpan
        //
        //  Actions: Common private ParseExactMultiple method called by both ParseExactMultiple and TryParseExactMultiple
        // 
        private static Boolean TryParseExactMultipleTimeSpan(String input, String[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, ref TimeSpanResult result) {
            if (input == null) {
                result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, nameof(input));
                return false;
            }
            if (formats == null) {
                result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, nameof(formats));
                return false;
            }

            if (input.Length == 0) {
                result.SetFailure(ParseFailureKind.Format, "Format_BadTimeSpan");
                return false;
            }

            if (formats.Length == 0) {
                result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier");
                return false;
            }

            //
            // Do a loop through the provided formats and see if we can parse succesfully in
            // one of the formats.
            //
            for (int i = 0; i < formats.Length; i++) {
                if (formats[i] == null || formats[i].Length == 0) {
                    result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier");
                    return false;
                }

                // Create a new non-throwing result each time to ensure the runs are independent.
                TimeSpanResult innerResult = new TimeSpanResult();
                innerResult.Init(TimeSpanThrowStyle.None);

                if(TryParseExactTimeSpan(input, formats[i], formatProvider, styles, ref innerResult)) {
                    result.parsedTimeSpan = innerResult.parsedTimeSpan;
                    return true;
                }
            }

            result.SetFailure(ParseFailureKind.Format, "Format_BadTimeSpan");
            return (false);
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:48,代码来源:TimeSpanParse.cs

示例8: TryParseExactMultipleTimeSpan

 private static bool TryParseExactMultipleTimeSpan(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, ref TimeSpanResult result)
 {
     if (input == null)
     {
         result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "input");
         return false;
     }
     if (formats == null)
     {
         result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "formats");
         return false;
     }
     if (input.Length == 0)
     {
         result.SetFailure(ParseFailureKind.Format, "Format_BadTimeSpan");
         return false;
     }
     if (formats.Length == 0)
     {
         result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier");
         return false;
     }
     for (int i = 0; i < formats.Length; i++)
     {
         if ((formats[i] == null) || (formats[i].Length == 0))
         {
             result.SetFailure(ParseFailureKind.Format, "Format_BadFormatSpecifier");
             return false;
         }
         TimeSpanResult result2 = new TimeSpanResult();
         result2.Init(TimeSpanThrowStyle.None);
         if (TryParseExactTimeSpan(input, formats[i], formatProvider, styles, ref result2))
         {
             result.parsedTimeSpan = result2.parsedTimeSpan;
             return true;
         }
     }
     result.SetFailure(ParseFailureKind.Format, "Format_BadTimeSpan");
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:40,代码来源:TimeSpanParse.cs

示例9: TryParseExactMultiple

 internal static bool TryParseExactMultiple(string input, string[] formats, IFormatProvider formatProvider, TimeSpanStyles styles, out TimeSpan result)
 {
     TimeSpanResult result2 = new TimeSpanResult();
     result2.Init(TimeSpanThrowStyle.None);
     if (TryParseExactMultipleTimeSpan(input, formats, formatProvider, styles, ref result2))
     {
         result = result2.parsedTimeSpan;
         return true;
     }
     result = new TimeSpan();
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:TimeSpanParse.cs

示例10: TryParse

 internal static bool TryParse(string input, IFormatProvider formatProvider, out TimeSpan result)
 {
     TimeSpanResult result2 = new TimeSpanResult();
     result2.Init(TimeSpanThrowStyle.None);
     if (TryParseTimeSpan(input, TimeSpanStandardStyles.Any, formatProvider, ref result2))
     {
         result = result2.parsedTimeSpan;
         return true;
     }
     result = new TimeSpan();
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:TimeSpanParse.cs


注:本文中的TimeSpanResult.Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。