本文整理汇总了C#中TimeSpan.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TimeSpan.Add方法的具体用法?C# TimeSpan.Add怎么用?C# TimeSpan.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertTimeLiteralValue
/// <summary>
/// Converts time literal value.
/// </summary>
private static TimeSpan ConvertTimeLiteralValue(string datetimeLiteralValue)
{
var datetimeParts = datetimeLiteralValue.Split(_datetimeSeparators, StringSplitOptions.RemoveEmptyEntries);
Debug.Assert(datetimeParts.Length >= 2, "time literal value must have at least 2 parts");
int hour;
int minute;
int second;
int ticks;
GetTimeParts(datetimeLiteralValue, datetimeParts, 0, out hour, out minute, out second, out ticks);
Debug.Assert(hour >= 0 && hour <= 24);
Debug.Assert(minute >= 0 && minute <= 59);
Debug.Assert(second >= 0 && second <= 59);
Debug.Assert(ticks >= 0 && ticks <= 9999999);
var ts = new TimeSpan(hour, minute, second);
ts = ts.Add(new TimeSpan(ticks));
return ts;
}
示例2: Main
static void Main(string[] args)
{
var db3 = new DBEntityInfomation();
db3.Property.Speed = 1;
db3.Property.Position.X = 4530;
db3.Property.Position.Y = 5430;
var db4 = new DBEntityInfomation();
db4.Property.Position.X = 100;
db4.Property.Position.Y = 33220;
System.TimeSpan time = new TimeSpan(0, 0, 0);
PlayerMoverAbility pma = new PlayerMoverAbility(db3);
pma.Move(db4.Property.Position, time.Ticks);
pma.Update(time.Add(new TimeSpan(0,0,50)).Ticks);
pma.Update(time.Add(new TimeSpan(0, 0, 99)).Ticks);
DBEntityInfomation db1 = new DBEntityInfomation();
db1.Property.Position.X = 100;
DBEntityInfomation db2 = new DBEntityInfomation();
db2.Property.Position.X = 100;
db2.Look.Name = "dff";
var ret = Regulus.Utility.ValueHelper.DeepEqual(db1, db2);
Regulus.NoSQL.Database db = new Regulus.NoSQL.Database();
db.Launch("mongodb://127.0.0.1:27017", "Keys");
db.Shutdown();
}