Coplt.ValueSemantics
0.2.1
dotnet add package Coplt.ValueSemantics --version 0.2.1
NuGet\Install-Package Coplt.ValueSemantics -Version 0.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Coplt.ValueSemantics" Version="0.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Coplt.ValueSemantics --version 0.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Coplt.ValueSemantics, 0.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Coplt.ValueSemantics as a Cake Addin
#addin nuget:?package=Coplt.ValueSemantics&version=0.2.1
// Install Coplt.ValueSemantics as a Cake Tool
#tool nuget:?package=Coplt.ValueSemantics&version=0.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Coplt.ValueSemantics
Value semantic extension
Value type inheritance
[ValueInherit]
[ValueBase]
Specify base type field
Example
namespace TheNamespace; public enum FooEnum { A, B } public record struct Foo<T>() { public int Field1 = 0; public static int Field2 = 0; public readonly int Field3 = 0; public readonly ref readonly int Prop1 => throw new NotImplementedException(); public int this[int a] { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public readonly object? Some(FooEnum a = FooEnum.A) => throw new NotImplementedException(); public void Some<A, B>(ref int a) => throw new NotImplementedException(); } [ValueInherit] public partial record struct Bar<T>() { [ValueBase] private Foo<T> _base = new(); }
Generate output:
<details> <summary>TheNamespace.Bar[T].ValueInherit.g.cs</summary>
// <auto-generated/> #nullable enable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace TheNamespace { public partial record struct Bar<T> { #region Field Forwards /// <inheritdoc cref="TheNamespace.Foo{T}.Field1"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] public ref int Field1 { [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] get => ref _base.Field1; } /// <inheritdoc cref="TheNamespace.Foo{T}.Field2"/> [global::Coplt.ValueSemantics.Metas.Forward] public static ref int Field2 { [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] get => ref TheNamespace.Foo<T>.Field2; } /// <inheritdoc cref="TheNamespace.Foo{T}.Field3"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] public readonly ref readonly int Field3 { [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] get => ref _base.Field3; } #endregion // Field Forwards #region Property Forwards /// <inheritdoc cref="TheNamespace.Foo{T}.Prop1"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] public readonly ref readonly int Prop1 { [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] get => ref _base.Prop1; } /// <inheritdoc cref="TheNamespace.Foo{T}[int]"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] public int this[int a] { [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] get => _base[a]; [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] set => _base[a] = value; } #endregion // Property Forwards #region Method Forwards /// <inheritdoc cref="TheNamespace.Foo{T}.Some(TheNamespace.FooEnum)"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public readonly object? Some(TheNamespace.FooEnum a = (TheNamespace.FooEnum)0) => _base.Some(a); /// <inheritdoc cref="TheNamespace.Foo{T}.Some{A, B}(ref int)"/> [global::Coplt.ValueSemantics.Metas.Forward] [global::System.Diagnostics.CodeAnalysis.UnscopedRef] [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public void Some<A, B>(ref int a) => _base.Some<A, B>(ref a); #endregion // Method Forwards } } // namespace TheNamespace
</details>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.