New answers tagged

3

If you want a cleaner version of dynamic/ExpandoObject, I would go step by step and fix what you don't like. Let's say you want to do something close to a Javascript-like syntax: obj = {}; obj.a = 123; obj.b = "message"; obj.c = [ 456, "something", {} ]; obj.d = { x: 50, y: [ "a", "b", "c" ], z: null }; obj.e = "eeee"; obj.d.z = { z: "zz" }; ...


2

I like the simplicity of this code. It may needs some improvements, but these are just to make it more flexible to be adopted to other projects (if it's intended for that). For most part, you've put the main functionalities on an extension class, which is something I wouldn't do myself. I think It would be better if Add, Remove, Get, and Set ...


-3

public static List<List<T>> ChunkBy<T>(this List<T> source, int chunkSize) { return source .Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / chunkSize) .Select(x => x.Select(v => v.Value).ToList()) .ToList(); }


Top 50 recent answers are included