Browsing 7239 questions and answers with Jon Skeet
Your map is entirely reasonable. You could create your own wrapper class if you wanted to, but I'd probably stick with the map for the moment. If Set<E> exposed an operation of "get the existing entry which is equal to this one" then... more 1/3/2016 8:29:30 AM
Yes, the count is the maximum number of bytes to be read in a call to Stream.Read, or the exact number of bytes to be written in a call to Stream.Write. Note that Stream.Read returns the actual number of bytes read, which may be less than... more 1/2/2016 1:33:05 PM
You just need a dependency on the System.Net.Sockets nuget package. Here's a complete example: Code: using System; using System.Net; using System.Net.Sockets; using System.Threading.Tasks; public class Program { public static void... more 1/2/2016 9:36:23 AM
It's an interpolated string literal, introduced in C# 6. It's broadly equivalent to: eventStream.ReceiveJoke += joke => Console.WriteLine(string.Format("Pretty nice joke: {0}, Thanks!!!", joke)); The compiler looks for braces... more 1/1/2016 6:12:04 PM
But for the first element i get 0.0 as a square root. why? Because you're not printing out the square root of the element - you're printing out the square root of the index. This: System.out.print(Math.sqrt(y)); should... more 1/1/2016 5:21:41 PM
Well, base64 represents 3 bytes in 4 characters... so to start with you just need to divide by 4 and multiply by 3. You then need to account for padding: If the text ends with "==" you need to subtract 2 bytes (as the last group of 4... more 12/31/2015 12:27:09 PM
The first thing to do is understand your structure. It's somewhat odd, because value is actually an array, containing a single object. You should work out what you would want to do if you ever had multiple objects there. Here's an example... more 12/29/2015 8:12:58 AM
I suspect the problem is that the only token sequence that can legitimately follow the keyword token of int in this case is . followed by class. The declaration statement you've got at the moment isn't valid because a local variable... more 12/25/2015 1:19:06 PM
It's an empty statement, that's all. It's perfectly legal, though usually useless. It's specified in section 14.6 of the JLS: An empty statement does nothing. EmptyStatement: ; ... more 12/24/2015 11:08:06 AM
What is the difference between those two ways of writing ? as I know both should work the same way. No, definitely not. In your first piece of code, if rs.getInt("purchased") returns a value other than 1, you assign a value of... more 12/23/2015 9:00:55 AM