From f96d5efdbdb1208ba44efd58f2b5c236d4c01c3e Mon Sep 17 00:00:00 2001 From: Ryan Lamansky <13633345+RyanLamansky@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:45:14 -0500 Subject: [PATCH] Minor update to take advantage of C# 12.0. --- WebAssembly.Tests/WebAssembly.Tests.csproj | 2 +- WebAssembly/RegeneratingWeakReference.cs | 11 ++--------- WebAssembly/WebAssembly.csproj | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/WebAssembly.Tests/WebAssembly.Tests.csproj b/WebAssembly.Tests/WebAssembly.Tests.csproj index 1e3b89c..18af70e 100644 --- a/WebAssembly.Tests/WebAssembly.Tests.csproj +++ b/WebAssembly.Tests/WebAssembly.Tests.csproj @@ -2,7 +2,7 @@ net8.0 - 10.0 + 12.0 WebAssembly enable True diff --git a/WebAssembly/RegeneratingWeakReference.cs b/WebAssembly/RegeneratingWeakReference.cs index ce12bff..a017a80 100644 --- a/WebAssembly/RegeneratingWeakReference.cs +++ b/WebAssembly/RegeneratingWeakReference.cs @@ -2,17 +2,10 @@ namespace WebAssembly; -readonly struct RegeneratingWeakReference +readonly struct RegeneratingWeakReference(Func regenerator) where T : class { - private readonly WeakReference reference; - private readonly Func regenerator; - - public RegeneratingWeakReference(Func regenerator) - { - this.reference = new WeakReference(regenerator(), false); - this.regenerator = regenerator; - } + private readonly WeakReference reference = new(regenerator(), false); public T Reference { diff --git a/WebAssembly/WebAssembly.csproj b/WebAssembly/WebAssembly.csproj index 7131b15..02d15a2 100644 --- a/WebAssembly/WebAssembly.csproj +++ b/WebAssembly/WebAssembly.csproj @@ -13,7 +13,7 @@ https://github.com/RyanLamansky/dotnet-webassembly Copyright © Ryan Lamansky. All rights reserved. WebAssembly WASM JIT - 10.0 + 12.0 enable https://github.com/RyanLamansky/dotnet-webassembly git