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


C# DateTimeResult.Init方法代码示例

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


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

示例1: TryParseExact

 internal static bool TryParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result) {
     result = DateTime.MinValue;
     DateTimeResult resultData = new DateTimeResult();       // The buffer to store the parsing result.
     resultData.Init();
     if (TryParseExact(s, format, dtfi, style, ref resultData)) {
         result = resultData.parsedDate;
         return true;
     }
     return false;
 }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:10,代码来源:DateTimeParse.cs

示例2: ParseExact

 internal static DateTime ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style) {
     DateTimeResult result = new DateTimeResult();       // The buffer to store the parsing result.
     result.Init();
     if (TryParseExact(s, format, dtfi, style, ref result)) {
         return result.parsedDate;
     }
     else {
         throw GetDateTimeParseException(ref result);
     }
 }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:10,代码来源:DateTimeParse.cs

示例3: TryParseExact

 internal static bool TryParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset) {
     result = DateTime.MinValue; 
     offset = TimeSpan.Zero;
     DateTimeResult resultData = new DateTimeResult();       // The buffer to store the parsing result. 
     resultData.Init(); 
     resultData.flags |= ParseFlags.CaptureOffset;
     if (TryParseExact(s, format, dtfi, style, ref resultData)) { 
         result = resultData.parsedDate;
         offset = resultData.timeZoneOffset;
         return true;
     } 
     return false;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:13,代码来源:DateTimeParse.cs

示例4: TryParseExact

 internal static bool TryParseExact(String s, String format, IFormatProvider provider, DateTimeStyles style, out DateTime result)
 {
     DateTimeFormatInfo dtfi = provider == null ? DateTimeFormatInfo.CurrentInfo : DateTimeFormatInfo.GetInstance(provider);
     result = DateTime.MinValue;
     DateTimeResult resultData = new DateTimeResult();       // The buffer to store the parsing result.
     resultData.Init();
     if (TryParseExact(s, format, dtfi, style, ref resultData))
     {
         result = resultData.parsedDate;
         return true;
     }
     return false;
 }
开发者ID:noahfalk,项目名称:corert,代码行数:13,代码来源:FormatProvider.DateTimeParse.cs

示例5: ParseExact

            internal static DateTime ParseExact(String s, String format, IFormatProvider provider, DateTimeStyles style)
            {
                DateTimeFormatInfo dtfi = provider == null ? DateTimeFormatInfo.CurrentInfo : DateTimeFormatInfo.GetInstance(provider);

                DateTimeResult result = new DateTimeResult();       // The buffer to store the parsing result.
                result.Init();
                if (TryParseExact(s, format, dtfi, style, ref result))
                {
                    return result.parsedDate;
                }
                else
                {
                    throw GetDateTimeParseException(ref result);
                }
            }
开发者ID:noahfalk,项目名称:corert,代码行数:15,代码来源:FormatProvider.DateTimeParse.cs

示例6: TryParse

 internal static bool TryParse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result, out TimeSpan offset) {
     result = DateTime.MinValue;
     offset = TimeSpan.Zero;
     DateTimeResult parseResult = new DateTimeResult();       // The buffer to store the parsing result.
     parseResult.Init();
     parseResult.flags |= ParseFlags.CaptureOffset;
     if (TryParse(s, dtfi, styles, ref parseResult)) {
         result = parseResult.parsedDate;
         offset = parseResult.timeZoneOffset;
         return true;
     }
     return false;
 }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:13,代码来源:DateTimeParse.cs

示例7: TryParseExactMultiple

        internal static bool TryParseExactMultiple(String s, String[] formats,
                                                DateTimeFormatInfo dtfi, DateTimeStyles style, ref DateTimeResult result) {
            if (s == null) {
                result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "s");
                return false;
            }
            if (formats == null) {
                result.SetFailure(ParseFailureKind.ArgumentNull, "ArgumentNull_String", null, "formats");
                return false;
            }

            if (s.Length == 0) {
                result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
                return false;
            }

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

            Contract.Assert(dtfi != null, "dtfi == null");

            //
            // 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", null);
                    return false;
                }
                // Create a new result each time to ensure the runs are independent. Carry through
                // flags from the caller and return the result.
                DateTimeResult innerResult = new DateTimeResult();       // The buffer to store the parsing result.
                innerResult.Init();
                innerResult.flags = result.flags;                
                if (TryParseExact(s, formats[i], dtfi, style, ref innerResult)) {
                    result.parsedDate = innerResult.parsedDate;
                    result.timeZoneOffset = innerResult.timeZoneOffset;
                    return (true);
                }
            }
            result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
            return (false);
        }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:46,代码来源:DateTimeParse.cs

示例8: TryParse

 internal static bool TryParse(String s, IFormatProvider provider, DateTimeStyles styles, out DateTime result)
 {
     DateTimeFormatInfo dtfi = provider == null ? DateTimeFormatInfo.CurrentInfo : DateTimeFormatInfo.GetInstance(provider);
     result = DateTime.MinValue;
     DateTimeResult parseResult = new DateTimeResult();       // The buffer to store the parsing result.
     parseResult.Init();
     if (TryParse(s, dtfi, styles, ref parseResult))
     {
         result = parseResult.parsedDate;
         return true;
     }
     return false;
 }
开发者ID:noahfalk,项目名称:corert,代码行数:13,代码来源:FormatProvider.DateTimeParse.cs

示例9: Parse

 internal static DateTime Parse(String s, IFormatProvider provider, DateTimeStyles styles, out TimeSpan offset)
 {
     DateTimeFormatInfo dtfi = provider == null ? DateTimeFormatInfo.CurrentInfo : DateTimeFormatInfo.GetInstance(provider);
     DateTimeResult result = new DateTimeResult();       // The buffer to store the parsing result.
     result.Init();
     result.flags |= ParseFlags.CaptureOffset;
     if (TryParse(s, dtfi, styles, ref result))
     {
         offset = result.timeZoneOffset;
         return result.parsedDate;
     }
     else
     {
         throw GetDateTimeParseException(ref result);
     }
 }
开发者ID:noahfalk,项目名称:corert,代码行数:16,代码来源:FormatProvider.DateTimeParse.cs

示例10: TryParseExactMultiple

 internal static bool TryParseExactMultiple(String s, String[] formats,
                                            IFormatProvider provider, DateTimeStyles style, out DateTime result, out TimeSpan offset)
 {
     DateTimeFormatInfo dtfi = provider == null ? DateTimeFormatInfo.CurrentInfo : DateTimeFormatInfo.GetInstance(provider);
     result = DateTime.MinValue;
     offset = TimeSpan.Zero;
     DateTimeResult resultData = new DateTimeResult();       // The buffer to store the parsing result.
     resultData.Init();
     resultData.flags |= ParseFlags.CaptureOffset;
     if (TryParseExactMultiple(s, formats, dtfi, style, ref resultData))
     {
         result = resultData.parsedDate;
         offset = resultData.timeZoneOffset;
         return true;
     }
     return false;
 }
开发者ID:noahfalk,项目名称:corert,代码行数:17,代码来源:FormatProvider.DateTimeParse.cs

示例11: TryParseExactMultiple

 internal static bool TryParseExactMultiple(string s, string[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
 {
     result = DateTime.MinValue;
     offset = TimeSpan.Zero;
     DateTimeResult result2 = new DateTimeResult();
     result2.Init();
     result2.flags |= ParseFlags.CaptureOffset;
     if (TryParseExactMultiple(s, formats, dtfi, style, ref result2))
     {
         result = result2.parsedDate;
         offset = result2.timeZoneOffset;
         return true;
     }
     return false;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:15,代码来源:DateTimeParse.cs

示例12: ParseExactMultiple

 internal static DateTime ParseExactMultiple(string s, string[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
 {
     DateTimeResult result = new DateTimeResult();
     offset = TimeSpan.Zero;
     result.Init();
     result.flags |= ParseFlags.CaptureOffset;
     if (!TryParseExactMultiple(s, formats, dtfi, style, ref result))
     {
         throw GetDateTimeParseException(ref result);
     }
     offset = result.timeZoneOffset;
     return result.parsedDate;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:13,代码来源:DateTimeParse.cs


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