LINQ doesn't cause `.Length` to disappear, but if you assign the array to an 
`IEnumerable<T>` then you won't seen the `.Length` property.

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of Tristan Reeves
Sent: Wednesday, 16 February 2011 11:54
To: ozDotNet
Subject: Re: LINQ extensions

 

But Length is always a (valid) property of arrays, whether or not LINQ is 
reference. Or are you saying that Length "disappears" when LINQ is referenced?

 

Tristan.

On Tue, Feb 15, 2011 at 4:23 PM, Ian Thomas <[email protected]> wrote:

Michael – slip of the fingers – yes, it was a .Count method (when LINQ is 
referenced), and a .Length property (when not). Not weird, lang c#

 

  _____  

Ian Thomas
Victoria Park, Western Australia

  _____  

From: [email protected] [mailto:[email protected]] On 
Behalf Of Michael Minutillo
Sent: Tuesday, February 15, 2011 1:20 PM
To: ozDotNet
Subject: Re: LINQ extensions

 

Weird. It should add a .Count() extension method, not a property. Are you 
coding in a language that has optional parentheses by any chance?

On Tue, Feb 15, 2011 at 1:12 PM, Ian Thomas <[email protected]> wrote:

FYI only

Just an oddity I hadn’t taken in before, that a reference to LINQ makes .Count 
a valid property of arrays (otherwise .Length is valid). 

I had been using LINQ to Objects in a small projects and changed it to not do 
so, meticulously cleaned references to LINQ out (VS2008 does not seem to do 
that thoroughly), and had a couple of errors arise with myarrays.Count 
statements I had been slack enough to write previously. 

Framework 3.5 

  _____  

Ian Thomas
Victoria Park, Western Australia

 

 

Reply via email to