IEnumerable
リストに複数の値を持つリストがあり、その値にはforeach
が必要です。今の質問はIEnumerable
で正しい方法をforeach
を行う方法であるforeachをIEnumerableオブジェクトでプレフォームする方法
A circular reference was detected while serializing an object of type 'System.Data.Entity.DynamicProxies.Place_F6C785C74658C47ED4BFCF45D13FE7D754CCA2F688B6CBDD079244CE52B46291'."
:私はこのコード
IEnumerable<object> Place = db.Places.Select(x => new { Id = x.Id, Nam1 = x.Name1, Name2 = x.Name2);
foreach(dynamic thisPlace in Place)
{
Response.Write (thisPlace.Id)
Response.Write (thisPlace.Name1)
Response.Write (thisPlace.Name2)
}
このコードは正常に動作しており、それが行わだ後、それはエラーがスローされますか?
使用
var
の代わりを使用する必要があります持っている場合でも? – Sajeetharanそれは間違っている私はそれを変更します – khaled
あなたはいくつかのC#の本を読むと良いです。 IEnumerableの代わりにvarを使用する場合