Browsing 7239 questions and answers with Jon Skeet
You're using an anonymous type to group, but you're not making any of those properties key properties... which means they aren't used in the equality tests. Try this: .GroupBy(Function(item) New With { Key .PRO_ID = item.PRO_ID, Key... more 8/12/2017 8:06:36 AM
It's not clear to me why specifying the type arguments fails, but that isn't needed anyway - and the location of CType looks to be broken. If you change the Select call to: .Select(CType(Function(x) CByte(10), Func(Of Byte, Byte))) then... more 8/11/2017 11:33:32 AM
But NullPointerException will be thrown anyway if a null object is dereferenced. So, why should one do this extra null check and throw NullPointerException? It means you detect the problem immediately and reliably. Consider: The... more 8/11/2017 10:29:55 AM
You can just use var, but you need to make sure the tuple elements are actually named. In C# 7.0, you need to do this explicitly: var tuples = source.Select(x => (A: x.A, B: x.B)); foreach (var tuple in tuples) { ... more 8/11/2017 10:07:44 AM
Just refactor the code to avoid the pointless local variable that's confusing things, taking advantage of the fact that within the if body, the compiler does know that everything is definitely assigned: public static long?... more 8/10/2017 1:58:35 PM
If you don't mind a bit of extra infrastructure, it's not too bad - you can create a DeferredEnumerable<T> class that just executes the given delegate every time it's asked for an iterator. A static non-generic class can then help... more 8/10/2017 12:03:25 PM
Will it hold the whole Test object in its environment, or only Test.b? Well, it will capture the variable test (by creating a separate class to contain that variable), which in turn has a value which is a reference to the instance of... more 8/8/2017 3:58:37 PM
There's nothing magic about disposal. The Dispose method is called - if you're not affecting anything that the tasks use, that should be fine. Likewise setting fp to null just stops fp from being treated as a GC root... although unless... more 8/8/2017 8:41:08 AM
You can set the credentials provider on the builder: GoogleCredentials credentials = GoogleCredentials.fromStream( new FileInputStream(PATH_TO_JSON_KEY))); Publisher pub = Publisher .defaultBuilder(topicName) ... more 8/8/2017 8:00:38 AM
Even though the anonymous types are accessible in your test project, that doesn't mean they'll be used when you write new { ... }. If you look at actionResult.Value.GetType() and expectedActionResult.Value.GetType() I strongly suspect... more 8/7/2017 8:32:27 AM