Browsing 7239 questions and answers with Jon Skeet
You're effectively trying to run java "Exercise 100" You want two arguments: "Exercise" and "100", so you should have them as different elements in the array: String[] runCommand = { "java", exerciseSelected, input }; Note that if... more 3/22/2018 2:51:34 PM
There's a sort of functionality that will help: the idea of "adjusters". If you write your own method that returns a Func<LocalTime, LocalTime> you can apply that to LocalTime, LocalDateTime, OffsetDateTime and OffsetTime (in 2.3+)... more 3/21/2018 7:38:57 AM
Just use TimeZoneInfo.IsDaylightSavingTime, passing in your UTC DateTime value. That will effectively convert that UTC value into the given time zone and check whether the result is in daylight saving time, although whether it actually... more 3/20/2018 2:57:13 PM
The reason it's not working is that you are currently declaring two local variables called areaHexes, each of which has a scope which is just the block they're declared in - so neither of them is in scope when you try to use... more 3/16/2018 6:58:36 PM
You can't use OfType on its own to achieve this, but you can use that with a Where clause afterwards: var windowList = Application.Current.Windows .OfType<Window>() .Where(w => w.GetType() == typeof(Window)) ... more 3/16/2018 3:52:49 PM
This is due to the difference between the Julian and Gregorian calendar systems. SimpleDateFormat uses the default calendar system, which I believe to be GregorianCalendar on both your system and mine. GregorianCalendar (despite its name)... more 3/16/2018 11:20:02 AM
You can definitely avoid the current repetition you've got with a generic method, but I wouldn't try to reduce it to a single method. Here's what I'd potentially do: protected static int ExecuteNonQuery(SqlCommand command) => ... more 3/15/2018 8:40:24 PM
You're using a method group conversion to create the Func<long, long, bool> used for the comparerFunc parameter. Unfortunately, the C# 5 specification currently requires that to create a new delegate instance each time it's run. From... more 3/15/2018 12:29:36 PM
You could explictly use a FileInputStream and an InputStreamReader using StandardCharsets.UTF_8, but it's probably simpler to use Files.newBufferedReader: Path path = Paths.get(csvFile); try (BufferedReader reader =... more 3/14/2018 11:56:46 AM
Unfortunately there's no real concept of an average of Period values, as they're not even directly comparable. For example, is "1 month" longer or shorter than "29 days"? It depends on the month. Moving to an average, what's the of the two... more 3/13/2018 7:05:51 PM