File tree Expand file tree Collapse file tree 5 files changed +22
-17
lines changed
Equatable.SourceGenerator Expand file tree Collapse file tree 5 files changed +22
-17
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFrameworks >netstandard2.0;net6 .0;net8 .0</TargetFrameworks >
4+ <TargetFrameworks >netstandard2.0;net8 .0;net9 .0</TargetFrameworks >
55 </PropertyGroup >
66
77 <ItemGroup Condition =" '$(TargetFramework)' == 'netstandard2.0' " >
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFrameworks >netstandard2.0;net6 .0;net8 .0</TargetFrameworks >
4+ <TargetFrameworks >netstandard2.0;net8 .0;net9 .0</TargetFrameworks >
55 <RootNamespace >Equatable</RootNamespace >
66 </PropertyGroup >
77
Original file line number Diff line number Diff line change 1- // Licensed to the .NET Foundation under one or more agreements.
2- // The .NET Foundation licenses this file to you under the MIT license.
3- // See the LICENSE file in the project root for more information.
4-
51using System . ComponentModel ;
62
7- // ReSharper disable once CheckNamespace
83namespace System . Runtime . CompilerServices ;
94
10- /// <summary>
11- /// Reserved to be used by the compiler for tracking metadata.
12- /// This class should not be used by developers in source code.
13- /// </summary>
145[ EditorBrowsable ( EditorBrowsableState . Never ) ]
15- internal static class IsExternalInit
16- {
17- }
6+ internal static class IsExternalInit ;
Original file line number Diff line number Diff line change 44namespace Equatable . SourceGenerator . Models ;
55
66[ ExcludeFromCodeCoverage ]
7- public readonly struct EquatableArray < T > ( T [ ] array ) : IEquatable < EquatableArray < T > > , IEnumerable < T >
7+ public readonly struct EquatableArray < T > : IEquatable < EquatableArray < T > > , IEnumerable < T >
88 where T : IEquatable < T >
99{
10- public T [ ] Array { get ; } = array ?? [ ] ;
10+ public static readonly EquatableArray < T > Empty = new ( ) ;
11+
12+
13+ public EquatableArray ( ) : this ( [ ] ) { }
14+
15+ public EquatableArray ( T [ ] array ) => Array = array ?? [ ] ;
16+
17+ public EquatableArray ( IEnumerable < T > items ) => Array = items . ToArray ( ) ?? [ ] ;
18+
19+
20+ public T [ ] Array { get ; }
1121
1222 public int Count => Array . Length ;
1323
24+
1425 public ReadOnlySpan < T > AsSpan ( ) => Array . AsSpan ( ) ;
1526
1627 public T [ ] AsArray ( ) => Array ;
@@ -44,4 +55,6 @@ public override int GetHashCode()
4455
4556
4657 public static implicit operator EquatableArray < T > ( T [ ] array ) => new ( array ) ;
58+
59+ public static implicit operator EquatableArray < T > ( List < T > items ) => new ( items ) ;
4760}
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFrameworks >netstandard2.0;net6 .0;net8 .0</TargetFrameworks >
4+ <TargetFrameworks >netstandard2.0;net8 .0;net9 .0</TargetFrameworks >
55 <IsPackable >false</IsPackable >
66 <Nullable >enable</Nullable >
77 <LangVersion >latest</LangVersion >
8+ </PropertyGroup >
9+
10+ <PropertyGroup Condition =" '$(Configuration)'=='Debug'" >
811 <EmitCompilerGeneratedFiles >true</EmitCompilerGeneratedFiles >
912 </PropertyGroup >
1013
You can’t perform that action at this time.
0 commit comments