Simply DevFast!


Hello DevFast!

DevFast stands for “Develop Fast”; and never means that to do faster code development we compromise the code quality or leave soft corners in the code.

Keeping this in mind, here we talk about a library that is easy to use, yet powerful, contains a set of extension methods, and that is equipped with extensive XML documentation too. A set of extension methods which any C# .Net programmer requires almost all the time.

In the v1 of this library we propose following features:

  • Carefully naming of methods to maintain code readability
  • Proposing a lot of quotidian programming needs as one-liner
  • Method chaining is all the way
  • Minimal boilerplate code
  • Extensively test covered



Trying Is Everything

Simplest way to understand what this lib can do for you is to:

  • Reference it in your project
  • Take a string variable and type .T to find possible extensions

DevFast Over Breakfast

Before we look are those methods, first let’s see if we would like to write following program:

“Create a function that accepts a string, parses it as DateTime, if parsing fails returns 12 Jan, 2000 as value”

To write such a program for such a simple requirement, we might:

  • need to consider null values
  • perform unit testing
  • maintain it throughout the project lifetime
  • most interestingly we need to spend time writing it! It means during that time we CANNOT do something else far more exciting!
  • above all, such mundane requirements are seldom project specific; so if not packetized, we need to reinvent the wheel again.

On the other hand, with DevFast added as reference, this code a one-liner. Let’s see a sample as the following picture:

String.T variants

  • .TryTo => string parsing to bool,int,long,decimal,DateTime,Enum,Type etc
  • .ToOrDefault => string parsing to bool,int,long,decimal,DateTime,Enum,Type etc with given default value
  • .To variants => string parsing to FileInfoDirectoryInfobool,int,long,decimal,DateTime,Enum,Type etc. Throws Exception when parsing fails.
  • .Trim variants => string trim specific methods
  • .Throw variants => Exception throwing methods when string satisfies certain conditions.
  • .ToBase64 / .FromBase64 variants => Base64 string conversion methods
  • .Transform variants => String transformation methods (Base64 is a special case)

.Throw variants

  • .ThrowIf / .ThrowIfNot => on bool. throws when true (ThrowIf) or false (ThrowIfNot). Though might look trivial but very powerful. Almost all other Throws fallbacks on it.
  • .ThrowIfNull => On any T which is class (ReferenceType).
  • .ThrowIfNullOrEmpty => On any T which is ICollection (ArrayList etc).
  • .ThrowOnMiss => On Dictionary / Collections type. When supplied Key / valye is not in it.
  • .ThrowIfZero / .ThrowIfNotZero => as the name suggests (intlong)
  • .ThrowIfEqual / .ThrowIfNotEqual => Any T which is IEquatable
  • .ThrowIfLess / .ThrowIfGreater => Any T which is IComparable
  • .ThrowIfBounded / .ThrowIfNotBounded => Any T which is IComparable

.ToBase64 variants

  • .ToBase64 / .FromBase64 => on stringbyte[]ArraySegment<byte>
  • .ToBase64Async/ .FromBase64Async => on stringbyte[]ArraySegment<byte>StringBuilderStream

Miscellaneous Methods

  • .TransformAsync => on stringbyte[]ArraySegment<byte>StringBuilderStream to perform various Crypto transformations
  • .CreateFileInfo => on DirectoryInfo to create FileInfo object.
  • .CreateBytes => on ArraySegment<byte> to create byte[]

Let’s NOT say Goodbye…

Here we discussed what we propose as v1 of DevFast. We are continuously adding more and more code in it to bring you helpful one-liners. We would be happy to know your requirements and on the way we’ll prioritize those.

Useful links:

Let us know your thoughts.