jonasschubert / 30-seconds-of-c-sharp Goto Github PK
View Code? Open in Web Editor NEWA curated collection of useful C# snippets that you can understand in 30 seconds or less.
License: MIT License
A curated collection of useful C# snippets that you can understand in 30 seconds or less.
License: MIT License
Filters out all values from an enumerable for which the comparator function does not return true
Returns a new array with n elements removed from the left.
use utcnow
Converts an angle from degrees to radians.
Returns tomorrow's date.
You can provide a DateTimeKind value to select Local Or Utc
Default is Utc
Returns true if the given number is even, false otherwise
Filters out the non-unique values in an enumerable, based on a provided comparator function (where linq statement).
Returns the last element for which the provided function returns a truthy value.
Counts the occurrences of a value in an enumerable.
Calculates the factorial of a number.
Returns every nth element in an enumerable.
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.
Returns the minimum of the given dates.
Returns the difference between two enumerables.
Checks if the provided integer is a prime number.
Check if a date is the same as another date.
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'
Converts an angle from radians to degrees.
Checks if the first numeric argument is divisible by the second one.
Generates an list, containing the Fibonacci sequence, up until the nth term.
Returns a new enumerable with n elements removed from the right.
Check if a date is after another date.
Converts an integer to a suffixed string, adding am or pm based on its value.
Check if a date is before another date.
Removes elements from the end of an array until the passed function returns true. Returns the remaining elements in the array.
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.
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.
Returns the difference between two enumerables, after applying the provided function to each enumerable element of both.
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).
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.
Returns the maximum of the given dates.
Filters out the non-unique values in an enumerable.
Chunks an array into smaller arrays of a specified size.
Returns the difference (in days) between two dates.
Deep flattens an enumerable.
Maybe use recursion. Recursively flatten each element that is an enumerable.
Checks an enumerable for duplicate values. Returns true if duplicate values exist and false if values are all unique.
bubbleSort uses the technique of comparing and swapping
Removes falsey values from an array.
Filter out falsey values (false, null, 0 and "") depending on the type.
Returns true if the string is y/yes or false if the string is n/no.
Returns true if the provided predicate function returns false for all elements in a collection, false otherwise.
Converts a 2D array to a comma-separated values (CSV) string.
Returns a string of the form HH:MM:SS from a DateTime or TimeSpan object.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.