Coder Social home page Coder Social logo

busterwood / goodies Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 3.0 979 KB

Useful stuff missing from .NET for example duck typing, CSP channels, caching, money, typed ids...

License: Apache License 2.0

C# 100.00%
csp channels collections money duck-typing equality caching

goodies's Introduction

Build status Nuget

BusterWood.Goodies

So much useful & free stuff for .NET, built as a library for .NET Standard 2.0.

Selected highlights

  • BusterWood.Batching namespace contains classes for batching together asynchronous method calls for efficiency.
  • BusterWood.Caching namespace contains time and space effecient Cache<,> and ReadThroughCache<,>.
  • BusterWood.Channels namespace contains CSP-like communication between (logical) asynchronous threads, including buffered and multicast channels.
  • BusterWood.Collections namespace contains the time and space effecient UniqueList<> which implements both IList<> and ISet<>. Additionally HashLookup<,> and CircularQueue<> classes are provided.
  • BusterWood.Ducks namespace contains run-time duck typing.
  • BusterWood.Equality namespace contains run-time creation of equality comparers using property names.
  • BusterWood.Goodies namespace contains structs to ensure you don't mix up your customer and order identifiers, and extension methods for arrays, enums, TimeSpans and strings.
  • BusterWood.Linq namespace contains 20% faster LINQ via batching, additional LINQ methods and asynchronous enumerables.
  • BusterWood.Logging namespace contains Log static class for structured logging to Console.Error (StdErr).
  • BusterWood.Mapping namespace contains extension methods for copying objects with rules for name and type conversion.
  • BusterWood.Monies namespace contains Money struct to ensure that you don't add accidentally add GBP and USD together.
  • BusterWood.Reflect.Emit namespace contains extension methods for emiting IL via ILGenerator.
  • BusterWood.Restarting namespace contains RestartMonitoring that monitor failures in asychrous processes and restarts them on failure (with delay).
  • BusterWood.Testing namespace contains a simple testing library inspired by Go's testing package

goodies's People

Contributors

busterwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

goodies's Issues

Unexpected behavior and Misleading comment in Select.ExecuteAsync

So here is function.
From comments I expect to get true after one of select statement get executed.
But instead in that case code returns false.
Even without any comment I expect to get true if everything went fine.

So code should
return !timedOut;
instead of return timedOut;
also
for infinitive timer we always should return true not false
if (timeout == System.Threading.Timeout.InfiniteTimeSpan || timeout == TimeSpan.MaxValue)
{
await ExecuteAsync();
return true;//!!!!!!!!!!!!!!!!!!!
}

  /// <summary>Tries to reads from one (and only one) of the added channels.  Does no action if the <paramref name="timeout"/> has been reached</summary>
        /// <returns>True if an action was performed, False if no action was performed and the timeout was reached</returns>
        public async Task<bool> ExecuteAsync(TimeSpan timeout)
        {
            if (timeout == System.Threading.Timeout.InfiniteTimeSpan || timeout == TimeSpan.MaxValue)
            {
                await ExecuteAsync();
                return false;
            }

            var timedOut = false;
            var receiveTimeout = new ReceiveCase<DateTime>(Timeout.After(timeout), _ => timedOut = true);
            var idx = cases.Count;
            cases.Add(receiveTimeout);
            await ExecuteAsync();
            cases.RemoveAt(idx);
            return timedOut;
        }

Memorise DbReader

If a DbRead r could be decorated with memorisation then it could be enumerated multiple times

AsyncEnumerable extensions

Where, Select and other asynchronous methods should be defined on AsyncEnumerable, not AsyncEnumerator

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.