裏面我的「MyOtherViewModel
」我有下面的代碼是存儲過程列表運行時間轉換
投擲的錯誤:Argument Type myStoredProcedure not Assignable to parameter type MyDbTable
它扔@(this, c)
編譯錯誤
var query = myWCFClient.myStoredProcedure();
//Some Other Stuff
query.ToList().ForEach(c => myCollection.Add(new MyViewModel(this, c)));
內MyViewModel
我有:
public MyViewModel(MyOtherViewModel owner, MyDbTable table)
:base(owner, "String")
{
//other stuff
}
然後我嘗試
var t = ((IEnumerable)query).Cast<MyDbTable>().ToList();
t.ToList().ForEach(c => mCollection.Add(new MyViewModel(this, c)));
而獲取:Unable to cast object of type 'myStoredProcedure' to type 'MyDbTable'.
運行時間錯誤
什麼是VS 2012
處理的最佳方式,c#
.Net 4.5
使用WCF。
程序是myStoredProcedure[]
,這是返回的0
是MyOtherViewModel,MyDbTable等真正的類名?如果是這樣,你應該考慮將它們重命名爲有意義的名稱。男孩,你的代碼會改進嗎? – venerik
不,他們不是真名,我就是這樣打的。 – user1307149