2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-07-02 19:13:43 -04:00

Add .editorconfig and apply formatting

This commit is contained in:
2023-08-27 15:20:26 +01:00
parent d1f0b9fd91
commit 696955463f
32 changed files with 7217 additions and 7194 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));
}
}