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


C# TimeOfDay.ToString方法代码示例

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


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

示例1: Convertion

        public static void Convertion(TimeOfDay time)
        {
            // 将TimeOfDay转换为string
            string time_to_str = time.ToString();
            Console.WriteLine(time_to_str);

            // 将string转换为TimeOfDay
            string str_to_time = "Evening";
            TimeOfDay time_type = (TimeOfDay)Enum.Parse(typeof(TimeOfDay), str_to_time, true);

        }
开发者ID:xxy1991,项目名称:cozy,代码行数:11,代码来源:A5Enum.cs

示例2: AddHours

        protected DateTime AddHours(DateTime datetime, TimeOfDay timeOfDay)
        {
            switch (timeOfDay)
            {
                case TimeOfDay.Night:
                    return datetime.AddHours(3);

                case TimeOfDay.Morning:
                    return datetime.AddHours(9);

                case TimeOfDay.Midday:
                    return datetime.AddHours(15);

                case TimeOfDay.Evening:
                    return datetime.AddHours(21);
            }

            throw new NotImplementedMethodException(datetime.ToString("dd-MMM-yyyy"), timeOfDay.ToString());
        }
开发者ID:ripa-alexandr,项目名称:weather,代码行数:19,代码来源:BaseProvider.cs

示例3: BuildString

 private static string BuildString(Date modifiedDate, TimeOfDay modifiedTime,
     Date? nullableModifiedDate, TimeOfDay? nullableModifiedTime)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("modifiedDate:").Append(modifiedDate).Append(",");
     sb.Append("modifiedTime:").Append(modifiedTime).Append(",");
     sb.Append("nullableModifiedDate:").Append(nullableModifiedDate == null ? "null" : nullableModifiedDate.ToString()).Append(",");
     sb.Append("nullableModifiedTime:").Append(nullableModifiedTime == null ? "null" : nullableModifiedTime.ToString());
     return sb.ToString();
 }
开发者ID:shailendra9,项目名称:WebApi,代码行数:10,代码来源:DateAndTimeOfDayController.cs

示例4: ToStringWithISOTimeFormat_s

 public void ToStringWithISOTimeFormat_s()
 {
     var time = new TimeOfDay(23, 59, 59);
     var s = time.ToString("s");
     Assert.Equal("23:59:59", s);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:6,代码来源:TimeOfDayFormattingTests.cs

示例5: ToStringWithCustomTimeFormat

 public void ToStringWithCustomTimeFormat()
 {
     var time = new TimeOfDay(23, 59, 59);
     var s = time.ToString("HH:mm:ss");
     Assert.Equal("23:59:59", s);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:6,代码来源:TimeOfDayFormattingTests.cs

示例6: ToStringWithNullTimeFormat

 public void ToStringWithNullTimeFormat()
 {
     var time = new TimeOfDay(23, 59, 59);
     var s = time.ToString((string) null);
     Assert.Equal("23:59:59", s);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:6,代码来源:TimeOfDayFormattingTests.cs

示例7: ToStringWithStandardTimeFormat

 public void ToStringWithStandardTimeFormat()
 {
     var time = new TimeOfDay(23, 59, 59);
     var s = time.ToString("t");
     Assert.Equal("23:59", s);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:6,代码来源:TimeOfDayFormattingTests.cs

示例8: WriteValue

        /// <summary>
        /// Write a TimeOfDay value
        /// </summary>
        /// <param name="writer">The text writer to write the output to.</param>
        /// <param name="value">TimeOfDay value to be written.</param>
        internal static void WriteValue(TextWriter writer, TimeOfDay value)
        {
            Debug.Assert(writer != null, "writer != null");

            WriteQuoted(writer, value.ToString());
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:11,代码来源:JsonValueUtils.cs

示例9: ToString

 /// <summary>
 /// Converts the given TimeOfDay value to the string appropriate for Atom format.
 /// </summary>
 /// <param name="time">The TimeOfDay value to convert.</param>
 /// <returns>The string version of the TimeOfDay in Atom format</returns>
 internal static string ToString(TimeOfDay time)
 {
     return time.ToString();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:9,代码来源:ODataAtomConvert.cs

示例10: SetTimeOfDay

        private void SetTimeOfDay(TimeOfDay timeOfDay)
        {
            _timeOfDay = timeOfDay;

              btnTimeOfDay.Content = _timeOfDay.ToString();
        }
开发者ID:thirkcircus,项目名称:ServiceBusMQManager,代码行数:6,代码来源:TimeControl.xaml.cs

示例11: TimeOfDayAsXml

 /// <summary>
 /// Converts the TimeOfDay to a String.
 /// </summary>
 /// <param name="time">The <see cref="Microsoft.OData.Edm.Library.TimeOfDay"/> to be converted</param>
 /// <returns>A System.String representation of the supplied <see cref="Microsoft.OData.Edm.Library.TimeOfDay"/>.</returns>
 internal static string TimeOfDayAsXml(TimeOfDay time)
 {
     var value = time.ToString();
     return value;
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:10,代码来源:EdmValueWriter.cs

示例12: WriteGreeting

 public static void WriteGreeting(TimeOfDay timeofDay)
 {
     switch (timeofDay)
     {
         case TimeOfDay.Morning:
             Console.WriteLine("Good " + timeofDay.ToString());
             break;
         default:
             Console.WriteLine("Hello!");
             break;
     }
 }
开发者ID:ianheyi,项目名称:CSharp,代码行数:12,代码来源:EnumNamespace.cs

示例13: ToStringWithEmptyTimeFormat

 public void ToStringWithEmptyTimeFormat()
 {
     var time = new TimeOfDay(23, 59, 59);
     var s = time.ToString("");
     Assert.Equal("11:59:59 PM", s);
 }
开发者ID:axxu,项目名称:corefxlab,代码行数:6,代码来源:TimeOfDayFormattingTests.cs


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