From 1575949762d0290b5695f412a6baed3b2331ac46 Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Tue, 22 Aug 2023 19:34:51 -0700 Subject: [PATCH] upgrade these for c#10 --- src/BizHawk.Bizware.Graphics/OpenGL/OpenGLVersion.cs | 3 +-- src/BizHawk.Common/Win32/Win32ShellContextMenu.cs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/BizHawk.Bizware.Graphics/OpenGL/OpenGLVersion.cs b/src/BizHawk.Bizware.Graphics/OpenGL/OpenGLVersion.cs index 376c127996..e1c0114a14 100644 --- a/src/BizHawk.Bizware.Graphics/OpenGL/OpenGLVersion.cs +++ b/src/BizHawk.Bizware.Graphics/OpenGL/OpenGLVersion.cs @@ -13,8 +13,7 @@ namespace BizHawk.Bizware.Graphics /// public static class OpenGLVersion { - // TODO: make this a ref struct once we're c# 10 (parameterless struct ctor) - private class SavedOpenGLContext : IDisposable + private readonly ref struct SavedOpenGLContext { private readonly IntPtr _sdlWindow, _glContext; diff --git a/src/BizHawk.Common/Win32/Win32ShellContextMenu.cs b/src/BizHawk.Common/Win32/Win32ShellContextMenu.cs index 516932e9d4..8f3279c025 100644 --- a/src/BizHawk.Common/Win32/Win32ShellContextMenu.cs +++ b/src/BizHawk.Common/Win32/Win32ShellContextMenu.cs @@ -243,7 +243,7 @@ namespace BizHawk.Common { var uri = new Uri(path); - // gongshell supported shell schemes, although that seems complicated to support and very edge case, so not bothering for now --cpp + // this should be the only scheme used in practice if (uri.Scheme != "file") { throw new NotSupportedException("Non-file Uri schemes are unsupported"); @@ -264,8 +264,7 @@ namespace BizHawk.Common ComInterface2 = (IContextMenu2)ComInterface; } - // TODO: ref struct when c# 10 - private class TempMenu : IDisposable + private ref struct TempMenu { [DllImport("user32.dll")] private static extern IntPtr CreatePopupMenu();