diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 03a383506f0460..b155cf927dd7c3 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -484,7 +484,6 @@ - diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs index c74d845a345def..a11dc0bfdd98bc 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Globalization; using System.Numerics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; @@ -478,8 +479,8 @@ internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr even int index; int refObjIndex = 0; - Debug.Assert(EtwAPIMaxRefObjCount == 8, $"{nameof(EtwAPIMaxRefObjCount)} must equal the number of fields in {nameof(EightObjects)}"); - EightObjects eightObjectStack = default; + Debug.Assert(EtwAPIMaxRefObjCount == 8, $"{nameof(EtwAPIMaxRefObjCount)} must equal the number of fields in {nameof(InlineArray8<>)}"); + InlineArray8 eightObjectStack = default; Span refObjPosition = stackalloc int[EtwAPIMaxRefObjCount]; Span dataRefObj = eightObjectStack; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs b/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs index 4f370df7937b0f..83d65496368fe8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs @@ -531,8 +531,7 @@ public override void Write([StringSyntax(StringSyntaxAttribute.CompositeFormat)] { if (GetType() == typeof(StreamWriter)) { - TwoObjects two = new TwoObjects(arg0, arg1); - WriteFormatHelper(format, two, appendNewLine: false); + WriteFormatHelper(format, [arg0, arg1], appendNewLine: false); } else { @@ -544,8 +543,7 @@ public override void Write([StringSyntax(StringSyntaxAttribute.CompositeFormat)] { if (GetType() == typeof(StreamWriter)) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - WriteFormatHelper(format, three, appendNewLine: false); + WriteFormatHelper(format, [arg0, arg1, arg2], appendNewLine: false); } else { @@ -602,8 +600,7 @@ public override void WriteLine([StringSyntax(StringSyntaxAttribute.CompositeForm { if (GetType() == typeof(StreamWriter)) { - TwoObjects two = new TwoObjects(arg0, arg1); - WriteFormatHelper(format, two, appendNewLine: true); + WriteFormatHelper(format, [arg0, arg1], appendNewLine: true); } else { @@ -615,8 +612,7 @@ public override void WriteLine([StringSyntax(StringSyntaxAttribute.CompositeForm { if (GetType() == typeof(StreamWriter)) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - WriteFormatHelper(format, three, appendNewLine: true); + WriteFormatHelper(format, [arg0, arg1, arg2], appendNewLine: true); } else { diff --git a/src/libraries/System.Private.CoreLib/src/System/InlineArrays.cs b/src/libraries/System.Private.CoreLib/src/System/InlineArrays.cs deleted file mode 100644 index 78394062ec942e..00000000000000 --- a/src/libraries/System.Private.CoreLib/src/System/InlineArrays.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Runtime.CompilerServices; - -namespace System -{ - [InlineArray(2)] - internal struct TwoObjects - { - private object? _arg0; - - public TwoObjects(object? arg0, object? arg1) - { - this[0] = arg0; - this[1] = arg1; - } - } - - [InlineArray(3)] - internal struct ThreeObjects - { - private object? _arg0; - - public ThreeObjects(object? arg0, object? arg1, object? arg2) - { - this[0] = arg0; - this[1] = arg1; - this[2] = arg2; - } - } - - [InlineArray(8)] - internal struct EightObjects - { - private object? _ref0; - } -} diff --git a/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/AsciiStringSearchValuesTeddyBase.cs b/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/AsciiStringSearchValuesTeddyBase.cs index b764e3a22d81ee..0869ad1553f895 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/AsciiStringSearchValuesTeddyBase.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/AsciiStringSearchValuesTeddyBase.cs @@ -109,7 +109,7 @@ internal abstract class AsciiStringSearchValuesTeddyBase _buckets; private readonly Vector512 _n0Low, _n0High, diff --git a/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs b/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs index 7acc23d53c6535..07a25d1c6a5cce 100644 --- a/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs +++ b/src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs @@ -459,14 +459,12 @@ public static string Format([StringSyntax(StringSyntaxAttribute.CompositeFormat) public static string Format([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1) { - TwoObjects two = new TwoObjects(arg0, arg1); - return FormatHelper(null, format, two); + return FormatHelper(null, format, [arg0, arg1]); } public static string Format([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1, object? arg2) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - return FormatHelper(null, format, three); + return FormatHelper(null, format, [arg0, arg1, arg2]); } public static string Format([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, params object?[] args) @@ -499,14 +497,12 @@ public static string Format(IFormatProvider? provider, [StringSyntax(StringSynta public static string Format(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1) { - TwoObjects two = new TwoObjects(arg0, arg1); - return FormatHelper(provider, format, two); + return FormatHelper(provider, format, [arg0, arg1]); } public static string Format(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1, object? arg2) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - return FormatHelper(provider, format, three); + return FormatHelper(provider, format, [arg0, arg1, arg2]); } public static string Format(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, params object?[] args) diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs index 0dcc60a825f986..83f9306b16ee71 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs @@ -1470,14 +1470,12 @@ public StringBuilder AppendFormat([StringSyntax(StringSyntaxAttribute.CompositeF public StringBuilder AppendFormat([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1) { - TwoObjects two = new TwoObjects(arg0, arg1); - return AppendFormat(null, format, (ReadOnlySpan)two); + return AppendFormat(null, format, [arg0, arg1]); } public StringBuilder AppendFormat([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1, object? arg2) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - return AppendFormat(null, format, (ReadOnlySpan)three); + return AppendFormat(null, format, [arg0, arg1, arg2]); } public StringBuilder AppendFormat([StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, params object?[] args) @@ -1518,14 +1516,12 @@ public StringBuilder AppendFormat(IFormatProvider? provider, [StringSyntax(Strin public StringBuilder AppendFormat(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1) { - TwoObjects two = new TwoObjects(arg0, arg1); - return AppendFormat(provider, format, (ReadOnlySpan)two); + return AppendFormat(provider, format, [arg0, arg1]); } public StringBuilder AppendFormat(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, object? arg0, object? arg1, object? arg2) { - ThreeObjects three = new ThreeObjects(arg0, arg1, arg2); - return AppendFormat(provider, format, (ReadOnlySpan)three); + return AppendFormat(provider, format, [arg0, arg1, arg2]); } public StringBuilder AppendFormat(IFormatProvider? provider, [StringSyntax(StringSyntaxAttribute.CompositeFormat)] string format, params object?[] args)