110,536
社区成员
发帖
与我相关
我的任务
分享
// 有一个函数
private string dosomething(data[] anyarray)
{
// 例如将数据转换为ascii字符串
// 其他问题先不考虑
}
// 我在某个函数中 必须要使用这个dosomething 函数
//例如里面的代码是这样的
public void allowdataArray(any)
{
if(dosomething(any).indexof("abc")>=0)
{
return;
}
otherfunction(dosomething(any));
}
// 在这个函数中我使用里两次dosomething(any),也就是说我执行了两次dosomething中的代码
// 但是我如果这样做
public void allowdataArray(any)
{
string temp=dosomething(any);
if(temp.indexof("abc")>=0)
{
return;
}
otherfunction(temp);
}
// 那么表示我执行了一次函数
class MyList
{
public static int Count
{
get
{
Sleep(1000);
return 10;
}
}
}
void Func()
{
int count = MyList.Count;
for(int i = 0;i < count;i++)
{}
}
void Func()
{
for(int i = 0;i < MyList.Count;i++)
{}
}