本文整理汇总了C#中Time.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Time.Add方法的具体用法?C# Time.Add怎么用?C# Time.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Time
的用法示例。
在下文中一共展示了Time.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTrain2
public static Train CreateTrain2() {
var stations = Stations.ToArray();
var train = new Train(TrainCategory.Passenger, "P4321");
var startTime = new Time(12, 00);
train.Add(new StationCall(stations[2]["2"], startTime, startTime.Add(30)));
train.Add(new StationCall(stations[1]["1"], startTime.Add(45), startTime.Add(51)));
train.Add(new StationCall(stations[0]["3"], startTime.Add(70), startTime.Add(180)));
return train;
}
示例2: CreateTrain1
public static Train CreateTrain1() {
var stations = Stations.ToArray();
var train = new Train(TrainCategory.Freight, "G1234");
var startTime = new Time(12, 00);
train.Add(new StationCall(stations[0]["3"], startTime, startTime.Add(30)));
train.Add(new StationCall(stations[1]["2"], startTime.Add(50), startTime.Add(57)));
train.Add(new StationCall(stations[2]["1"], startTime.Add(70), startTime.Add(180)));
return train;
}
示例3: Can_Add_TimeSpan
public void Can_Add_TimeSpan()
{
Time t1 = new Time(3, 50);
TimeSpan timeSpan = new TimeSpan(1,2,15,0); //1d 2t 15min 0sec
Time t3 = t1.Add(timeSpan);
Assert.AreEqual(6, t3.Hour);
Assert.AreEqual(5, t3.Minute);
}
示例4: Can_Add_Time
public void Can_Add_Time()
{
Time t1 = new Time(3,50);
Time t2 = new Time(1,45);
Time t3 = t1.Add(t2);
Assert.AreEqual(5,t3.Hour);
Assert.AreEqual(35,t3.Minute);
}
示例5: AddShouldThrowException
public void AddShouldThrowException()
{
var date = new Time();
date.Add(null);
}
示例6: After
public static Time After(this Interval interval, Time origin)
{
return origin.Add(interval);
}