आप सही तरीके से बाहर बिंदु के रूप में, group
एक आरक्षित शब्द नहीं है (भाषा डिजाइनरों नई आरक्षित कीवर्ड लागू करने के लिए नहीं है, जब वे आदेश मौजूदा कार्यक्रमों नहीं तोड़ करने के लिए भाषा में नई सुविधाएं शामिल अथक प्रयास करते हैं)। हालांकि, यह प्रासंगिक कीवर्ड है: यह LINQ क्वेरी अभिव्यक्तियों के भीतर एक कीवर्ड बन जाता है। रिशेर्पर सुझाव दे रहा है कि आप अस्पष्टताओं से बचने के लिए चर में चर का नाम बदलें, जिसके परिणामस्वरूप यह चर क्वेरी क्वेरी अभिव्यक्तियों के भीतर उपयोग किया गया था।
language specification से:
7.16.1 Ambiguities in query expressions
Query expressions contain a number of “contextual keywords”, i.e., identifiers that have special meaning in a given context. Specifically these are from, where, join, on, equals, into, let, orderby, ascending, descending, select, group and by. In order to avoid ambiguities in query expressions caused by mixed use of these identifiers as keywords or simple names, these identifiers are considered keywords when occurring anywhere within a query expression. For this purpose, a query expression is any expression that starts with “from identifier” followed by any token except “;”, “=” or “,”.
आप निम्नलिखित करने की कोशिश की, तो आप एक संकलक त्रुटि मिलती हैं:
var filteredParis = from pair in group.Pairs // group is now treated as a keyword
select pair;
हाँ, यह आप एक सुरक्षित (संरक्षित नहीं) कीवर्ड का उपयोग करने की अनुमति देता है , लेकिन यह _any_ परिवर्तनीय नाम से पहले भी अनुमति है। क्यों resharper यह सुझाव देता है, एक और सवाल है, हालांकि LINQ [समूह] (http://msdn.microsoft.com/en-us/library/bb384063.aspx) खंड एक अच्छा उम्मीदवार है। – Oded
'समूह' सी # में एक प्रासंगिक कीवर्ड है। [MSDN] देखें (http://msdn.microsoft.com/en-us/library/x53a06bb.aspx) –
'समूह द्वारा फ़िल्टर किए गए समूह समूह समूह में समूह से। कुछ' –