निम्नलिखित काम करता है के रूप में उम्मीद में होने की उम्मीद int काम नहीं कर के रूप में (LINQ संस्थाओं के लिए):Nullable LINQ (सी #)
var topics = (from t in ctx.Topics where t.SubjectId == subjectId && t.ParentId == null select new { t.Title, t.Id }).ToList();
हालांकि, निम्नलिखित रिटर्न कुछ भी नहीं:
int? parent = null;
var topics = (from t in ctx.Topics where t.SubjectId == subjectId && t.ParentId == parent select new { t.Title, t.Id }).ToList();
Topic.ParentId है एक निरर्थक int। चारों ओर काम करना आसान है, लेकिन यह मुझे पहेली करता है। क्या कोई किसी तरह की रोशनी दिखा सकता है?
बचाव के लिए जॉन स्कीट! ;-) –
वही प्रश्न यहां: http://stackoverflow.com/questions/682429/how-can-i-query-for-null-values-in-entity-framework/4262617#4262617 – Slauma