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
.Tto 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
- 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:
- .TryTo => string parsing to
- .ToOrDefault => string parsing to
Typeetc with given default value
- .To variants => string parsing to
Typeetc. Throws Exception when parsing fails.
- .Trim variants => string
- .Throw variants => Exception throwing methods when string satisfies certain conditions.
- .ToBase64 / .FromBase64 variants =>
Base64string conversion methods
- .Transform variants => String transformation methods (
Base64is a special case)
- .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
- .ThrowIfNullOrEmpty => On any
- .ThrowOnMiss => On Dictionary / Collections type. When supplied Key / valye is not in it.
- .ThrowIfZero / .ThrowIfNotZero => as the name suggests (
- .ThrowIfEqual / .ThrowIfNotEqual => Any
- .ThrowIfLess / .ThrowIfGreater => Any
- .ThrowIfBounded / .ThrowIfNotBounded => Any
- .ToBase64 / .FromBase64 => on
- .ToBase64Async/ .FromBase64Async => on
- .TransformAsync => on
Streamto perform various
- .CreateFileInfo => on
- .CreateBytes => on
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.
Let us know your thoughts.