© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
4 replies
2spooky2play

✅ Strange output of my code

        var query = Enumerable.Range(1, 1000)
            .Where(x => x % 2 == 0)
            .Aggregate((x, y) => x * y);

        Console.WriteLine(query);
        var query = Enumerable.Range(1, 1000)
            .Where(x => x % 2 == 0)
            .Aggregate((x, y) => x * y);

        Console.WriteLine(query);

why does this output 0? is it due to overflow, and if it is, why is an exception not thrown?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

❔ Getting multiple output of my count in this code:https://pastebin.com/c7RsL47e
C#CC# / help
3y ago
✅ Different output on same code.
C#CC# / help
17mo ago
✅ Review my Code of Pong
C#CC# / help
8mo ago
✅ Case 3 of my code.
C#CC# / help
3y ago