Skip to content

Instantly share code, notes, and snippets.

View NoelFB's full-sized avatar

Noel Berry NoelFB

View GitHub Profile
@NoelFB
NoelFB / StackString.cs
Created October 5, 2023 04:43
simple stack-based C# string
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
/// <summary>
/// Stack-based String
/// </summary>
[InterpolatedStringHandler]
[SkipLocalsInit]
public unsafe struct StackString
{
@NoelFB
NoelFB / StackUtf8.cs
Created October 5, 2023 04:45
Stack based UTF8 string in C#
using System.Buffers;
using System.Buffers.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// Stack-based UTF8 string for ImGui.
/// I frequently want to do short string manipulation (ex. $"{Icon} Play!") and this
/// avoids allocating on the new strings every single frame.
@NoelFB
NoelFB / CSharpNativeLibs.md
Created March 30, 2026 07:07
Copy native libs in a local C# project

I want to copy OS-specific native runtime libraries to the bin directory. This will copy them, but will copy ALL runtimes (win-x64, linux-x64, osx, etc).

<ItemGroup>
  <Content Include="libs/**/*.*" CopyToOutputDirectory="PreserveNewest" Link="%(Filename)%(Extension)" />
</ItemGroup>