A set of non-coupled re-usable code blocks (each a single .cs file) meant to be distributed via Nuget. Code blocks is not a framework, nor will it ever be. Each block is meant for one and only one purpose. CodeBlocks contains a factory, a command line parser, a high performance Activator replacement, a generic differ and much more!
- declcmdparser - A powerful, declarative command-line parsing system in a single .cs file. You can include this in any project with almost zero footprint and very easy/readable usage, as shown below. Generic, type-safe switches for any types convertible from string via a TypeConverter are supported. Declarative command line parser sample
- genericfactory - A generic, flexible, static factory written in C# contained in a single file for easy inclusion in any project. You'll never have to write another factory again. The main points of extensibility are exposed so you can control it's behavior without re-writing boilerplate code. Static generic flexible factory sample
- differ - A generic, static class that can diff two IEnumerables with user-supplied diffing functions. Visit the project page for samples and more information. Differ Sample
- fasteractivator - This high performance alternative to Activator uses System.Reflection.Emit namespace to generate methods that can dynamically create objects at runtime. Used properly, this class can help if you have performance bottlenecks with Activator. FasterActivator Sample
- indexable - This simple abstraction allows you to expose properties that look like named indexers (get and/or set) in a class. This allows greater expressiveness than having to define a method for, say, a calculated field. Indexable sample
- linqimageprocessing - A single-file, easy to include set of extension methods on the Bitmap class that allow inherently stream oriented processing of images using LINQ. This is also faster than unsafe code for large images. Linq Image Processing sample
All the above blocks are available via nuget for frictionless development!
If you have code blocks or ideas for code blocks, please contact me at ananth at
net. As noted in the project description, I am looking for blocks that can fit in a single file without (ideally) any external dependencies.