C# Code Snippets

 

All C# Code Snippets are under the Visual C# Kicks license agreement

 

Delete Self
  • 3.9/5
Allows a standalone program to delete itself.

Shuffle Lists and Arrays
  • 3.77/5
An in-place algorithm to randomly shuffle a list or array in C#

Distance Calculation using Latitude and Longitude in C#
  • 3.75/5
ZIPCodeWorld provides this routine to calculate the distance between two points in C#.

Print Console Table
  • 3.75/5
Allows a Console App to create a basic table (with headers)

Distance Formula
  • 3.66/5
A simple implementation of the distance formula in C#

TinyUrl Updater
  • 3.63/5
Allows you to update a standalone app using TinyUrl.

Degree To Point and Back
  • 3.6/5
Convert an angle in degrees into an XY-coordinate point and back.

Project a 2D Point on a Line
  • 3.59/5
Perpendicularly project a 2D point onto a 2D line.

Temporary File Class
  • 3.54/5
Easily handle temporary file management in C#

Taking Screenshots with C#
  • 3.52/5
Using API calls in C# to capture an image of the monitor screen.

Combination Function
  • 3.51/5
A simple function to calculate the number of possible combinations.

Data to CSV
  • 3.5/5
Write a DataTable or a DataView to a CSV file.

Jiggle
  • 3.44/5
This little snippet jiggles(shakes) your windows form.

Sort Strings by Length
  • 3.36/5
Sort a collection of strings by their length, from shortest to longest.

Linq Objects
  • 3.36/5
Querying linq objects

Multilevel Hierarchy - Class Interface
  • 3.34/5
An example of a multilevel hierarchy using class interfaces

Periodic Table in string[][] Array
  • 3.32/5
Has every known element in a two dimensional array

Encryption Class
  • 3.18/5
Class to easily encrypt strings and other types of data.

Fraction Structure
  • 3.11/5
A C# struct to represent decimal numbers as fractions.

Generic String Parsing
  • 3.05/5
A generic function for converting a string into a type.

Extension methods for string hasing and encryption
  • 2.97/5
This collection deals with strings security, with these extensions you can properly use hashing and encryption.

RNGCryptoServiceProvider Random Integer
  • 2.84/5
Generate a random integer in a range using the RNGCryptoServiceProvider class.

Point in Triangle New
  • 2.79/5
The traditional method is to use barycenter coordinates. By using parameterized triangle line segments, an interpolated point may be found.

PHP Time
  • 2.73/5
Returns time represented in the same way as the PHP time() function.

Factorial
  • 2.61/5
Calculate the factorial value of a number in C#.NET

Convert MySQL CreateTable Statements to MS-SQL New
  • 2.55/5
Convert the create table definition from MySQL ready to use into Microsoft SQL Server 2008