Giter VIP home page Giter VIP logo

Comments (5)

Programm3r avatar Programm3r commented on August 21, 2024

@jreina would it be acceptable to add other extension methods for IEnumerable<T> to the repo?

Thanks!

from shittylinq.

jreina avatar jreina commented on August 21, 2024

@Programm3r
Absolutely! Just opened #4 specifically for this.

from shittylinq.

Programm3r avatar Programm3r commented on August 21, 2024

@jreina many thanks!

from shittylinq.

tosti007 avatar tosti007 commented on August 21, 2024

Hope that this helps :)

One sidenote: I opted to go for the parameterless constructor constraint, since just using default will result in null for objects/classes.
Using the constructor constraint solves this and it also works for structs and types.

I am really bad at unit testing so I was hoping someone else has idea's for good cases.

from shittylinq.

jreina avatar jreina commented on August 21, 2024

@tosti007 thanks for your PR!

Looking at these specifications for the Aggregate function, it looks like the signature for this overload should be different and the behavior is slightly different as well.

Instead of constructing a new instance of T and creating a constraint on what types can be used here, the function should instead use the first element in the sequence as the seed value and throw an InvalidOperationException if the sequence is empty. That allows us to get rid of the U type parameter altogether.

Regarding unit tests, I think the tests should ensure this new function throws an InvalidOperationException when the sequence is empty, and make sure the first item in the sequence is used as the seed.

from shittylinq.

Related Issues (20)

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.