Coder Social home page Coder Social logo

bubdm / caseof Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stanshillis/caseof

0.0 0.0 0.0 1.07 MB

Micro library inspired by F# single case discriminated unions. Create primitive domain concepts in C# with one line.

License: MIT License

C# 53.88% F# 40.71% Shell 5.41%

caseof's Introduction

Micro library inspired by F# single case discirminated unions.

Create primitive domain concepts in C# with one line.

class Age : CaseOf<int, Age> {}

Pass around instances worry free, they are immutable and implement value based equality.

var hisAge = Age.New(23);
var herAge = Age.New(23);

Assert.IsTrue(herAge.Equals(hisAge));

Implicit downcasting to wrapped typed.

int integerHisAge = hisAge;
int integerHerAge = herAge.Value;

Assert.IsTrue(integerHisAge.Equals(integerHerAge));

Create Action<> or Func<> delegates that are descriptive.

class Username : CaseOf<string, Username> {}
class Email : CaseOf<string, Email> {}

Action<Username, Email> register = (name, email) => { /* .... */ }

Available on Nuget or direct embedding (just copy CaseOf.cs file to your project)

caseof's People

Contributors

stanshillis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.