Skip to content

Instantly share code, notes, and snippets.

View luozhijian's full-sized avatar

luozhijian

View GitHub Profile
@mjs3339
mjs3339 / Converters.cs
Last active December 16, 2024 09:36
C# Convert from Primitive to Byte Array and Back
public static class Converters
{
public static bool IsValidPrimitive(Type type)
{
switch(Type.GetTypeCode(type))
{
case TypeCode.Boolean:
case TypeCode.Char:
case TypeCode.SByte:
case TypeCode.Byte: