tôi đang cố gắng thực thi mã mẫu của LINQ to JSON (đề cập dưới đây) nhưng nó được đem lại cho tôi lỗi sauLINQ to JSON: InvalidOperationException: Lambda Parameter không trong phạm vi
Stack Trace:
[InvalidOperationException: Lambda Parameter không trong phạm vi]
Mã tôi đang thực hiện là:
JObject rss =
new JObject(
new JProperty("id", "James Newton-King"),
new JProperty("name", "http://james.newtonking.com"),
new JProperty("data", "James Newton-King's blog."),
new JProperty("children",
new JArray(
from p in mwsysbot.Software
where p.SoftwareName == name
select new JObject(
new JProperty("id",p.SoftwareUUID),
new JProperty("name", p.SoftwareName)
)
)
)
);
Ngoài ra khi tôi xóa dòng "new JProperty (" name ", p.SoftwareName)", mã thực thi hoàn hảo.
Tại sao?
Bạn có thể đăng stacktrace ngoại lệ của mình không? Tôi khá chắc chắn rằng lỗi không đến từ Json.NET. –