Category: tinyTypes

  • Tiny Types–documentation–part 4

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ tiny types in C# Tiny types is a NuGET dll,https://www.nuget.org/packages/TinyTypesObjects/ Also,you can find the construction here: http://msprogrammer.serviciipeweb.ro/category/tinytypes/ The documentation is copied shameless from https://github.com/jan-molak/tiny-types Installation To install the module from nuget : … Install-Package TinyTypesObjects … Defining Tiny Types An int on its own is just a…

  • TinyTypes–adding equality operator–part 3

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ Now we have come to the interesting part – the equality operator. We have already operator equals,but not == [code lang=”csharp”] [TestMethod] public void TestSimpleIntOperatorEqual() { int nr = 7; TinyType<int> tt1 = nr; TinyType<int> tt2 = nr; Assert.AreEqual(tt1,tt2); Assert.IsFalse(tt1 == tt2); } [TestMethod] public void TestSimpleStringOperatorEqual()…

  • Tiny Types part 2–adding IEquatable

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ As always,the bigger problem is adding equality. The Tiny Type should be equal with the inner value – and with the other type with the same value. And,in C#,when you implement equality,there is a whole theory – see https://msdn.microsoft.com/en-us/library/336aedhh(v=vs.100).aspx . So the code to define equality is…

  • Tiny types in C#–part 1

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ I have read about tiny types in Javascript  – at https://darrenhobbs.com/2007/04/11/tiny-types/ and at https://janmolak.com/tiny-types-in-typescript-4680177f026e . It was an interesting idea – especially in this world of REST API . I decided to make the same on C# – so here it is: https://github.com/ignatandrei/tinyTypes and at https://www.nuget.org/packages/TinyTypesObjects .…