本文介绍了将代码vb.net转换为c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim A = DateDiff(DateInterval.Minute,datefrom,dateto)
i希望将此代码转换为c#请帮帮我?
Dim A = DateDiff(DateInterval.Minute, datefrom, dateto)
i want convert this code to c# please help me?
推荐答案
dynamic A = DateAndTime.DateDiff(DateInterval.Minute, datefrom, dateto);
使用以下工具。
[]
DateTime datefrom = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0)); // move back time
DateTime dateto = DateTime.Now;
TimeSpan tmp = dateto - datefrom;
long diff = (long)tmp.TotalMinutes;
// or the one liner
long diff = (long)(dateto - datefrom).TotalMinutes;
这篇关于将代码vb.net转换为c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!