Giter Site home page Giter Site logo

jonasschubert / 30-seconds-of-c-sharp Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 5.0 598 KB

A curated collection of useful C# snippets that you can understand in 30 seconds or less.

License: MIT License

C# 100.00%
30-seconds-of-code csharp education learn-to-code learning-resources programming snippets snippets-collection

30-seconds-of-c-sharp's People

Contributors

denisbiondic avatar jonasschubert avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

30-seconds-of-c-sharp's Issues

Enumerable.drop

Returns a new array with n elements removed from the left.

Date.tomorrow

Returns tomorrow's date.
You can provide a DateTimeKind value to select Local Or Utc
Default is Utc

Math.isEven

Returns true if the given number is even, false otherwise

Enumerable.findLast

Returns the last element for which the provided function returns a truthy value.

Method.hz

Returns the number of times a method executed per second. hz is the unit for hertz, the unit of frequency defined as one cycle per second.

Math.isOdd

Checks if the provided integer is a prime number.

Date.formatDuration

Returns the human readable format of the given number of milliseconds.

Divide ms with the appropriate values to obtain the appropriate values for day, hour, minute, second and millisecond. Filter to keep only non-zero values. Create the string for each value, pluralizing appropriately. Combine the values into a string.

e.g. formatDuration(34325055574); // '397 days, 6 hours, 44 minutes, 15 seconds, 574 milliseconds'

Math.isDivisible

Checks if the first numeric argument is divisible by the second one.

Math.fibonacci

Generates an list, containing the Fibonacci sequence, up until the nth term.

Enumerable.dropRightWhile

Removes elements from the end of an array until the passed function returns true. Returns the remaining elements in the array.

Enumerable.sortedDirection

Returns Direction.Ascending if the enumerable is sorted in ascending order, Direction.Descending if it is sorted in descending order or Direction.NotSorted if it is not sorted or has only one value.

Enumerable.bifurcate

Splits values into two groups. If an element in filter is truthy, the corresponding element in the collection belongs to the first group; otherwise, it belongs to the second group.

Enumerable.differenceSelect

Returns the difference between two enumerables, after applying the provided function to each enumerable element of both.

Enumerable.countBy

Groups the elements of an enumerable based on the given function and returns the count of elements in each group as dictionary, objects as key and count of object as value (uint).

Add to conplementAG

As this is part of our Coding Dojo, I would like to have this in our companies account. I will come to you tomorrow, @DenisBiondic, to do that.

Enumerable.deepFlatten

Deep flattens an enumerable.

Maybe use recursion. Recursively flatten each element that is an enumerable.

Enumerable.hasDuplicates

Checks an enumerable for duplicate values. Returns true if duplicate values exist and false if values are all unique.

Enumerable.compact

Removes falsey values from an array.

Filter out falsey values (false, null, 0 and "") depending on the type.

Utility.yesNo

Returns true if the string is y/yes or false if the string is n/no.

Enumerable.none

Returns true if the provided predicate function returns false for all elements in a collection, false otherwise.

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.