Browsing 7239 questions and answers with Jon Skeet
It sounds like you want something like: var lines = from goEntry in sd.goEntries from mbEntry in goEntry.mbEnties from methodEntry in mbEntry.methodsEntries select string.Format("{0}: {1}.{2}", ... more 4/4/2014 3:21:56 PM
You haven't specified a format provider, so it's using the one from the current culture. If you always want to use :, you should specify an appropriate provider, e.g.: setting.SettingValue = dt.ToString("yyyy-MM-dd HH:mm:ss.fff", ... more 4/4/2014 1:18:53 PM
You're not changing the value of the variable within SumElements - that still refers to the same array that it did before. Note how there's no assignment to a within the SumElements method. Instead, you're changing the contents of the... more 4/4/2014 12:14:02 PM
You can't look the type up in the dictionary that way. You'll have to loop through the key-value pairs: Type targetType = defaultValue.GetType(); foreach (var pair in dictionary) { if (pair.Key.IsAssignableFrom(targetType)) { ... more 4/4/2014 11:24:43 AM
This code is trying to do something similar to MoreLINQ's DistinctBy method, but not as well. Fundamentally, the idea is that given a collection of items, you want to find a distinct set of items, but specifically testing for distinctness... more 4/4/2014 9:06:25 AM
Basically the compiler implicitly creates a constructor taking a reference to the outer class, which is stored in a hidden field. So your code is somewhat like this: class Outer { int o = 10; static class Inner { private... more 4/4/2014 8:47:41 AM
Given your comment, it sounds like all you need is: char[] chars = str.ToCharArray(); Array.Sort(chars); A char value in .NET is actually a UTF-16 code unit, but for all ASCII characters, the UTF-16 code unit value is the same as the... more 4/4/2014 6:52:05 AM
Two options to consider: Use dynamic typing to call a generic method which will return you a Func<object, object> which you can use later by wrapping up an expression-tree-compiled delegate: public Func<Object, Object>... more 4/4/2014 6:49:13 AM
The problem at the moment is that your SimpleDateFormat is in your local time zone, whereas Date.getTime() gives you the milliseconds since the Unix epoch in UTC. You can fix this as: SimpleDateFormat formatter = new... more 4/4/2014 6:36:46 AM
Sure - you're just trying to join on a compound key, which is usually accomplished with an anonymous type: var query2 = from e in existingThresholds join d in defaultThresholdson on new { e.ThresholdType,... more 4/3/2014 4:12:54 PM