Browsing 7239 questions and answers with Jon Skeet
It looks like you don't really want to compare the values in terms of "greater than or less than" - but for equality. So you should use EqualityComparer.Default: public static bool UpdateField<T>(ref T target, T value) { bool... more 7/7/2016 5:25:47 PM
Your async method just returns void, which means there's no simple way of anything waiting for it to complete. (You should almost always avoid using async void methods. They're really only available for the sake of subscribing to events.)... more 7/7/2016 9:29:06 AM
Sure, just use Select: cboDay.DataSource = Enumerable.Range(1, 31) .Select(x => new KeyValuePair<int, int>(x, x)) .ToList(); It's not clear whether you need this to be List<T>, but doing so guarantees that it's... more 7/7/2016 8:59:31 AM
Well yes, you're reading the whole file into memory and then encrypting the whole thing in one go. You don't need to do that - you can do the whole thing in a streaming approach. You need three streams: One stream to read input from One... more 7/7/2016 6:33:27 AM
You can use dotnet cli for full framework apps and libraries as well. You just need to use the appropriate framework tag - for example "net46" to target .NET 4.6. You can target multiple frameworks, too: For example, from my Noda Time... more 7/6/2016 5:16:16 PM
Is there a way to simplify my code? Well, you could simplify it a bit: public class IncludeMapper<T1> { private readonly Dictionary<String, List<LambdaExpression>> _properties = new... more 7/6/2016 9:19:05 AM
One reasonably simple option: Put the maps on disk Sort them (in any of a number of ways) Open a reader for each map, and read the first line Iterate over the lines of each map, deciding which map to read from based on a comparison of... more 7/6/2016 7:10:56 AM
The simplest approach is just to use the index to iterate: for (int i = 0; i < list.Count; i++) { backgroundWorks.ReportProgress(i + 1); // Do stuff with list[i] } more 7/6/2016 6:04:29 AM
The idea is that you make AreaComparer generic like this: public class AreaComparer<T> : IComparer<T> where T : IShape { public int Compare(T x, T y) { return x.Area.CompareTo(y.Area); } } Then when you... more 7/5/2016 3:50:25 PM
I would try to go for a pure project.json approach. For example, here's a project.json file which will build a single package which supports netstandard1.0, PCL profile 328, and .NET 4.6 - with each configuration defining its own symbols... more 7/5/2016 3:34:30 PM