Browsing 7239 questions and answers with Jon Skeet
You can't do it in a generic way without making the type generic instead of the method, basically. You can store the reference, but it would have to be via a field of a non-generic type, e.g. IEnumerable or even just object. To really use... more 12/9/2013 6:46:06 AM
No, Select always yields one output element for each input element. There's no alternative to that. You could easily write your own FilteredSelect extension method - but it's simpler just to use a Where clause. Alternatively, use... more 12/8/2013 1:11:15 PM
You need to move your method call into your main method (or at least some method). Currently it's not in a method - only declarations (of fields, methods, nested types etc) can be at the top level of a class. Additionally, you're not... more 12/8/2013 1:01:22 PM
I suspect you're using i within the first loop, capturing it with a lambda expression or anonymous method, like this: for (int i = 0; i < taskCollection.Length; i++) { taskCollection[i] = Task.Run(() =>... more 12/7/2013 8:34:26 AM
So it sounds like you're trying to express the opposite of a constraint such as: var Foo<T>() where T : SomeClass That would constrain T to be SomeClass or a subclass1... but you're trying to make it explicitly not a T. No, I'm... more 12/6/2013 11:01:00 PM
It is my understanding that each time I instantiate friend, I reuse the same location in memory, overwriting the existing Person object, if present. No, that's not the case. You're overwriting the previous value in the variable - but... more 12/6/2013 10:42:42 PM
I am querying a SQL database via LINQ in my C# project and returning the data to a var type variable The type of the variable isn't var - that's just the form of declaration you're using. The type of the variable is whatever the... more 12/6/2013 8:36:04 PM
I suspect this is a namespace problem. You're only specifying the namespace for the feed element, not for entry or link. Try this: XmlNode link = xmlDoc.SelectSingleNode("dn:feed/dn:entry/dn:link", nsmgr); Personally I'd use LINQ to XML... more 12/6/2013 6:38:00 PM
You seem to be assuming that imageIn.Save(ms, ImageFormat.Bmp); will be writing exactly one byte per pixel. In fact, it's storing it in BMP format - which may well be more than one byte per pixel due to headers, and the fact that you... more 12/6/2013 5:02:55 PM
This happens from multiple threads synchronized via locks. I suspect you forgot to lock in one place, basically. Is that possible, or are you certain you only access it within a single place? For example, I can see how you'd get that... more 12/6/2013 3:05:14 PM