Browsing 7239 questions and answers with Jon Skeet
This looks like it's a bug in the library, around removing an entry. If you just remove an entry and then save again, it correctly removes the file. However, if you remove an entry and then add another one with the same name - which is... more 9/23/2015 9:01:31 AM
To get compile-time checking of the name of the property, you can keep the dynamic typing, but get the runtime "mini-compiler" to do the hard work: object data = LegacyCode(); object payload = GetPayload(data); // Use... more 9/22/2015 9:27:02 PM
You can use FileStream.SetLength: If the given value is less than the current length of the stream, the stream is truncated. In this scenario, if the current position is greater than the new length, the current position is moved to the... more 9/22/2015 8:01:13 PM
The compile-time type of the expression on the RHS of the = operator for the first two lines is dynamic. In the first case that's because you've cast to dynamic, and in the second case it's because you're using a dynamic value in one of... more 9/22/2015 5:22:48 PM
This is precisely what lookups are for - so use ToLookup instead of ToDictionary: ILookup<DateTime, Detail> result = (from master in db.master join details in db.detail on master.ID equals detail.ID select new {... more 9/22/2015 12:39:10 PM
Assuming Talend is just using the format patterns of SimpleDateFormat, you want yyyy-MM-dd 00:00:00.000 - the problem you're seeing at the moment is that D means day of year, not day of month. That's why you're getting 118 - because April... more 9/22/2015 12:24:20 PM
My Noda Time project is able to parse ISO-8601 durations as Period objects, which can then be used for calendrical arithmetic with LocalDate or LocalDateTime values. For example: var pattern = PeriodPattern.NormalizingIsoPattern; var text... more 9/22/2015 10:34:22 AM
You shouldn't do it for a date, as that can be ambiguous (the start of the day in standard time and the end of the day in daylight time, or vice versa) but instead ask whether a specific point in time is in daylight time: Dim zoneId As... more 9/22/2015 9:22:21 AM
The simplest way to measure "depth" is to count ancestors: var elementsAtDepth8 = xsd.Descendants() .Where(x => x.Ancestors().Count() == 8); No need to write your own recursive code at all. Another slightly... more 9/22/2015 8:57:25 AM
To get the local system time, you do need to worry about the time zone. You can use: var clock = SystemClock.Instance; // Or inject it, preferrably // Note that this *could* throw an exception. You could use //... more 9/22/2015 7:23:53 AM