Watch
2
0
Fork
You've already forked raylib-cs
0

Add .editorconfig and apply formatting

This commit is contained in:
Rgebee 2023-08-27 15:20:26 +01:00
commit 696955463f
32 changed files with 6831 additions and 6808 deletions

View file

@ -30,41 +30,40 @@ using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace Raylib_cs.Tests
namespace Raylib_cs.Tests;
public static class BlittableHelper
{
public static class BlittableHelper
public static bool IsBlittable<T>()
{
public static bool IsBlittable<T>()
{
return IsBlittableCache<T>.VALUE;
}
return IsBlittableCache<T>.VALUE;
}
public static bool IsBlittable(this Type type)
public static bool IsBlittable(this Type type)
{
if (type == typeof(decimal))
{
if (type == typeof(decimal))
{
return false;
}
if (type.IsArray)
{
var elementType = type.GetElementType();
return elementType != null && elementType.IsValueType && IsBlittable(elementType);
}
try
{
var instance = FormatterServices.GetUninitializedObject(type);
GCHandle.Alloc(instance, GCHandleType.Pinned).Free();
return true;
}
catch
{
return false;
}
return false;
}
private static class IsBlittableCache<T>
if (type.IsArray)
{
public static readonly bool VALUE = IsBlittable(typeof(T));
var elementType = type.GetElementType();
return elementType != null && elementType.IsValueType && IsBlittable(elementType);
}
try
{
var instance = FormatterServices.GetUninitializedObject(type);
GCHandle.Alloc(instance, GCHandleType.Pinned).Free();
return true;
}
catch
{
return false;
}
}
private static class IsBlittableCache<T>
{
public static readonly bool VALUE = IsBlittable(typeof(T));
}
}