我在某个地方读到有人可以在运行时访问配置值,但不能在设计时访问。在这种情况下,运行时和设计时的区别是什么?
我在某个地方读到有人可以在运行时访问配置值,但不能在设计时访问。在这种情况下,运行时和设计时的区别是什么?
设计时间是在根据需求创建设计或创建一些UML图表时的时间。
运行时间是在实现您的设计并运行代码时的时间。
设计时间是指你设计代码的时候
运行时间是指你执行你所设计好的代码的时候
运行时是你的程序运行时。设计时是你的程序设计时。
// you need to recompile your solution to change this,
// hence it is said that its value is set at design time.
const string value = "this is set at design time";
// You do not need to recompile your solution to change this,
// hence the value is said to be set at runtime.
string value = ConfigurationManager.GetValue("section", "key");