c# - 在 XML 开头记录程序结束时间
问题描述
我正在开发 Autodesk Revit 和另一个平台之间的插件,该平台需要从 Revit 导出的 XML 文件,并且此 XML 需要在其开头记录的开始和结束时间。
记录开始时间很容易,但是如何在 XML 的开头记录结束时间?下面的简单例子。
// Some blocks of code here...
string startDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK");
xmlWriter.WriteAttributeString("StartDateTime", startDateTime);
xmlWriter.WriteAttributeString("EndDateTime", endDateTime); //this obviously causes an error as the variable either not defined, initiated or doesn't have the information yet.
// Some more blocks of code here...
string endDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffffffK");
解决方案
推荐阅读
- out-of-memory - 用于 GPU 加速的混合 MPI/OpenMP 中的“内存不足”
- c# - Razor 引擎字符串插值
- apache - Https 服务器在本地工作,而不是使用 Apache 2.4 通过互联网
- php - 根据列值过滤 MySQL 查询,但返回共享该特定值的其余结果
- sql - 如何在 SQL Vertica 中按日期列连接具有不同日期格式的表?
- sql - 插入查询返回错误:SQL 错误:ORA-01861:文字与格式字符串不匹配
- python - 从古腾堡德项目中刮取书籍正文
- blazor-server-side - CSP 元标记不正确:阻止所有字体和 JS
- openvino - Visual Studio 调试模式下的 VCRUNTIME140_1D 错误
- r - 列出可能存在或不存在的对象