Browsing 7239 questions and answers with Jon Skeet
Can Portable Class Libraries be used for simple classes that contain function libraries and no UI components? Absolutely, although the more modern alternative to PCLs is .NET Core libraries. PCLs had various issues in terms of tooling... more 5/6/2017 3:40:08 PM
Assuming dr is a SqlDataReader or similar, you probably want to cast to DateTime, then format the value appropriately: DateTime dateTime = (DateTime) dr[3]; string formatted = dateTime.ToString("yyyy-MM-dd HH:mm",... more 5/5/2017 7:56:23 AM
Currently, you need the same code that exists within the gut of Noda Time, but it's not very much: internal static string WindowsToIana(string windowsZoneId) { // Avoid UTC being mapped to Etc/GMT, which is the mapping in CLDR if... more 5/5/2017 6:12:47 AM
Yes, I would strongly advise using null checks: It shows that you expect that the values can be null, and that that in itself is not a problem If you ever add logging in your catch block, you can easily do so without being spammed by... more 5/5/2017 5:54:18 AM
If you're happy with it still using the new tooling, the easiest approach is probably just to edit the project file (csproj). Right-click on the project in Solution Explorer and you should have a context menu option of "Edit... more 5/4/2017 4:16:51 PM
Basically because it would be pointless. Look at the documentation: If the length of b is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the... more 5/4/2017 2:31:23 PM
Basically, because time zone data changes over time. It sounds like timezonedb is up-to-date, but tzdataisn't. This change was made in the 2017a release of the IANA time zone data. From the announcement email - emphasis mine: Changes... more 5/4/2017 12:44:35 PM
I'd suggest using List<T>.BinarySearch: that will find the index of the date. If the index is 0 or more, then the exact date was found. If it's negative, then taking ~index will get you the index where the date would have been... more 5/4/2017 8:44:17 AM
I haven't tried this, but I'd expect you to be able to effectively chain the request initializers together: final GoogleCredential credential = ...; HttpTransport httpTransport =... more 5/3/2017 9:47:53 AM
Shouldn't the default object be created only if it is not there in the map ? How could that be the case? This call: map.getOrDefault("1", new Empl("dumnba")) is equivalent to: String arg0 = "1"; Empl arg1 = new... more 5/2/2017 11:47:51 AM