Skip to content
/ CLSS Public

A collection of independent or loosely-coupled tools to enhance the syntax of C# in a minimal way.

Notifications You must be signed in to change notification settings

tonygiang/CLSS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

CLSS - The C# Language Syntactic Sugar suite

A collection of independent or loosely-coupled packages to enhance the syntax of C# in a minimal way.

Why CLSS?

The C# Language Syntactic Sugar suite was created out of my frustration working with C#. The language and its Class Library have not evolved fast enough to address the inconsistencies, performance traps, unintuitiveness and lacking accommodation of common use-cases despite it is very much inline with the language's tradition to accommodate such use-cases. It still lacks some batteries for a "batteries included" language, even long after the inclusion in the BCL of types that serve a very niche use case such as the Version type that parses version strings in the major.minor[.build[.revision]] syntax and also programmatically implements IComparable<T> and IEquatable<T>.

Even when these concerns are addressed, they only come to the latest versions of the language and Class Library. Working in a bleeding-edge .NET environment is a luxury for many developers.

Our good friends such as language-ext, csharp-extensions and CSharpFunctionalExtensions made great efforts to address such concerns but one issue remains. Like many other language extension packages, their monolithic structure creates a high risk of conflicting with existing extension methods in your own projects once you using their namespaces.

CLSS set out to go in a different direction.

Modular

CLSS suite embraces the Unix philosophy. CLSS tried not to be one monolothic package but rather an umbrella for multiple packages. Each package is laser-focused on providing one functionality and can be installed (mostly) independently of other packages. Only install what you want and what is compatible with your current project, and no more.

More batteries

There are several irregulaties in the .NET Standard Library.

Why is there a GetOrAdd method for ConcurrentDictionary but not for other Dictionary types?

Why is there a ForEach method for List<T> but not for other iteratable collections?

Why does Enum.Parse allow non-Enum value types in its type parameter?

If you ever felt like these irregularities should not have existed to provide better consistency, CLSS suite offers a solution for you. It fills in the gaps left by the Base Class Library. Its XML comments do the best to resemble ones that ship with classes and methods in the BCL. Its implementations try to follow the .NET reference source as closely as possible. CLSS suite is built to make the BCL feel complete, to take the "batteries included" philosophy one step further. To add more batteries, so to speak.

Inkeeping with the intent to feel like a natural part of the language and its Class Library, CLSS will be averse to being revolutionary such as language-ext. CLSS packages may lean toward the syntax of functional programming, but will commit to the familiarity of the C# syntax. No monad or endofunctor here. Just functional programming the way you can still recognize as C#.

Polyfilling

A secondary goal of CLSS suite is to polyfill for older language versions and .NET versions. Some of the features from new .NET versions that CLSS can polyfill are: LINQ MaxBy/MinBy, shared Random instance and array filling.

CLSS packages multi-target .NET Standard 2.0 and - wherever possible - as low as .NET Standard 1.0. Learn how compatible these standards are here.

How to install & use

You can find and install every CLSS packages under the 'CLSS' tag on the NuGet Gallery.

To start using CLSS packages after installing, add this line to the top of your C# source file:

using CLSS;

How to contribute

Package-specific issues should be submitted to their respective repositories. If you have an idea that you think should make it into the shared CLSS namespace, submit an issue to this repository.

What this suite contains

Below is the list of packages contained in the CLSS suite so far:

New in Update 1:
New in Update 2:
New in Update 3:
New in Update 5:
New in Update 6:
New in Update 8:

About

A collection of independent or loosely-coupled tools to enhance the syntax of C# in a minimal way.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published