属性或索引器不可能会作为传出或引用传递参数 [英] A property or indexer may not be passed as an out or ref parameter
本文介绍了属性或索引器不可能会作为传出或引用传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到上述错误,并无法加以解决。 我GOOGLE了一下,但无法摆脱它。
I am getting the above error and unable to resolve it. I googled a bit but can't get rid of it.
方案:
我有类BudgetAllocate其财产被预算是double类型的。
I have class BudgetAllocate whose property is budget which is of double type.
在我dataAccessLayer,
In my dataAccessLayer,
在我的课,我想这样做的一个:
In one of my classes I am trying to do this:
double.TryParse(objReader[i].ToString(), out bd.Budget);
这是引发此错误:
Which is throwing this error:
属性或索引可能无法通过为out或ref参数 编译时间。
Property or indexer may not be passed as an out or ref parameter at compile time.
我甚至尝试这样的:
double.TryParse(objReader[i].ToString().Equals(DBNull.Value) ? "" : objReader[i].ToString(), out bd.Budget);
其他一切工作正常与层之间的引用是present。
Everything else is working fine and references between layers are present.
推荐答案
您无法使用
double.TryParse(objReader[i].ToString(), out bd.Budget);
一些变量替换bd.Budget。
replace bd.Budget with some variable.
double k;
double.TryParse(objReader[i].ToString(), out k);
这篇关于属性或索引器不可能会作为传出或引用传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文