本文介绍了在C#中表示时间对象的最佳做法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在数据库表中有一个时间列。日期并不重要,我们只是想要一天的时间。什么类型最好在C#中表示它?我要使用一个DateTime,但是我不喜欢这个日期的想法。解决方案
你可以使用结构来表示.NET中的一个时间。
I have a Time column in a database table. The date is not important, we just want a time in the day. What type would be best to represent it in C#? I was going to use a DateTime, but I don't like the idea of having a date.
解决方案
You could use a TimeSpan structure to represent a time in .NET.
这篇关于在C#中表示时间对象的最佳做法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!