【发布时间】:2012-06-24 03:36:12
【问题描述】:
请考虑以下代码:
1)public static class MyClass
2){
3) public static DateTime MyMethod(DateTime dt)
4) {
5) DateTime temp = new DateTime();
6) temp = dt.AddDays(1);
7) return temp;
8) }
9)}
对于MyMethod 的任何调用,temp 变量是否都有实例?还是因为它位于静态类中的静态方法中,而在内存中分配了一个 temp 变量实例?
谢谢
【问题讨论】: