Skip to content

Instantly share code, notes, and snippets.

View congdanhqx-zz's full-sized avatar

DOAN Tran Cong Danh congdanhqx-zz

View GitHub Profile
public static class TypeExtensions
{
/// <summary>
/// Determine whether a type is simple (String, Decimal, DateTime, etc)
/// or complex (i.e. custom class with public properties and methods).
/// </summary>
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/>
public static bool IsSimpleType(
this Type type)
{
@congdanhqx-zz
congdanhqx-zz / Shuffle.cs
Last active December 28, 2015 21:19 — forked from anonymous/Shuffle
Shuffle An Array in C#
/// <summary>
/// Shuffle an <seealso cref="Array"/> of type <typeparamref name="T"/>
/// then return it for chaining.
/// </summary>
/// <typeparam name="T">Type of element in array.</typeparam>
/// <param name="array">The array which need to shuffle. This array will be modified.</param>
/// <returns>The modified array. It's the same reference with the input array.</returns>
public T[] Shuffle<T>(T[] array)
{
Random rnd = new Random();