我要定义在C#中的函数有两个参数,他们有他们的默认值,比如方法包含默认参数值
public T AccessEntity(string Id = null, string File = null)
{
return (from e in ServiceContext.CreateQuery<T>(TableName)
where e.RowKey == Id || e.File == File
select e).FirstOrDefault();
}
现在有了这个功能,用户可以通过文件或ID,但如果用户搜索他们的战绩尝试通过文件搜索记录,然后我们如何将第一个参数映射到第二个形式参数而不传递任何虚拟值作为第一个参数。
我不想这样:invokingobj.AccessEntity(null, "name of file");
这可能吗?
+1,算上我对每个人都感到困惑...... – 2012-07-23 16:21:13