Browsing 7239 questions and answers with Jon Skeet
If you don't need to have anything other than the default comparison, you can use: // TODO: Rename the parameter... public static void BubbleSort<T>(this List<T> array) { IComparer<T> comparer =... more 6/2/2014 11:43:58 AM
You could use Class.forName("your.pkg.MyStaticBlockClass"). That was how JDBC used to work - the static initializer in the driver class would register itself as being capable of handling specific URLs. Now, that mechanism was superceded... more 6/2/2014 11:39:52 AM
The compiler message says it all - you're trying to assign a new value to button, but the iteration variable (the one declared by a foreach statement) is read-only. A foreach loop can only be used to iterate over the existing content in a... more 6/2/2014 10:25:21 AM
You're assuming that contains() will call memberInCollection.equals(candidate) rather than candidate.equals(memberInCollection). The documentation goes against that: More formally, returns true if and only if this list contains at... more 6/2/2014 8:17:05 AM
Well your static method doesn't have an instance of the form to work with. The simplest approach is just to stop it from being a static method. There's no obvious reason why you'd want it to be a static method anyway - or why you'd want... more 6/1/2014 9:32:21 PM
The approach is basically invalid, because there's no appropriate type to refer to. An anonymous type is just a normal type as far as the CLR is concerned - the compiler just generates the type for you. (In the Microsoft implementation it... more 6/1/2014 6:26:50 PM
Is it working as intended? It's working as specified, at least. Whether that's what you intended or not is a different matter :) From section 15.4 of the C# 5 specification - emphasis mine: Invocation of a delegate instance whose... more 6/1/2014 5:46:43 PM
This is the problem: nNumOfSentBytes += m_socketChannel.write(m_sendBuf); nTotalNumOfSentBytes += nNumOfSentBytes; You don't seem able to decide the meaning of nNumOfSentBytes - on the first line it looks like you're actually treating... more 5/31/2014 5:19:27 PM
You appear to have a single hyperlink object, accessed via a variable called hyperlnk. If you want to have multiple links, you'll need to create multiple links. (You can see all the label text, because you're appending to the label text... more 5/31/2014 12:32:28 PM
It sounds like you really want BitArray - just offset the value by 4 so you've got a range of [0, 32764] and you should be fine. That will allocate an array which is effectively 4K in size (32764 / 8), with one bit per value in the array.... more 5/30/2014 4:20:22 PM