Skip to main content

RSCG_UtilityTypes by Andrei Ignat

NuGet / site data​

NugetNuget GitHub last commit GitHub Repo stars

Details​

Info​

Original Readme​

note

RSCG_UtilityTypes

Omit and Pick from TypeScript : https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys

generating also extension for converting from one type to another . See demo project.

Usage​

Add to your csproj file

  <ItemGroup>
<PackageReference Include="RSCG_UtilityTypes" Version="2023.1223.1230" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="RSCG_UtilityTypesCommon" Version="2023.1223.1230" />
</ItemGroup>

In C# 9.0

[Omit("MoviePreviewSmall", nameof(Actors),nameof(Year))]
[Pick("MoviePreviewMinimal", nameof(Title), nameof(Year))]
public class Movie
{
public string? Title { get; set; }
public string? Director { get; set; }
public int Year { get; set; }
public string[]? Actors { get; set; }
}

And 2 new classes will be generated , MoviePreviewSmall and MoviePreviewMinimal

About​

note

Add omit and pick to selectively generate types from existing types

How to use​

Example (source csproj, source files)​

This is the CSharp Project that references RSCG_UtilityTypes

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RSCG_UtilityTypes" Version="2023.1223.1230" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<PackageReference Include="RSCG_UtilityTypesCommon" Version="2023.1223.1230" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files​

Those are taken from $(BaseIntermediateOutputPath)\GX

namespace UtilDemo
{
partial class Person1
{
public string FirstName { get; set; }
public string LastName { get; set; }

public static explicit operator Person1(PersonFull data )
{
var ret= new Person1 ();
ret.FirstName = data.FirstName;
ret.LastName = data.LastName;
return ret;
}



public static explicit operator PersonFull(Person1 data )
{
var ret= new PersonFull ();
ret.FirstName = data.FirstName;
ret.LastName = data.LastName;
return ret;
}


}
}

Useful​

Download Example (.NET C#)​

Share RSCG_UtilityTypes​

https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_UtilityTypes

aaa

Category "EnhancementClass" has the following generators:​

1 AOP.Logging.SourceGenerator Nuget GitHub Repo stars 2026-08-30

2 ApparatusAOT Nuget GitHub Repo stars 2023-04-16

3 AspectGenerator Nuget GitHub Repo stars 2024-01-07

4 CommonCodeGenerator Nuget GitHub Repo stars 2024-04-03

5 Comparison Nuget GitHub Repo stars 2025-05-25

6 DudNet Nuget GitHub Repo stars 2023-10-27

7 Enhanced.GetTypes Nuget GitHub Repo stars 2024-09-17

8 FastGenericNew Nuget GitHub Repo stars 2023-08-10

9 Immutype Nuget GitHub Repo stars 2023-08-12

10 Ling.Audit Nuget GitHub Repo stars 2023-12-12

11 Lombok.NET Nuget GitHub Repo stars 2023-04-16

12 M31.FluentAPI Nuget GitHub Repo stars 2023-08-25

13 MemberAccessor Nuget GitHub Repo stars 2025-03-24

14 MemoryPack Nuget GitHub Repo stars 2023-08-04

15 Meziantou.Polyfill Nuget GitHub Repo stars 2023-10-10

16 Microsoft.Extensions.Logging Nuget GitHub Repo stars 2023-04-16

17 Microsoft.Extensions.Options.Generators.OptionsValidatorGenerator Nuget GitHub Repo stars 2023-11-17

18 Microsoft.Interop.JavaScript.JSImportGenerator 2023-04-16

19 NLog.Extensions.ThisClass Nuget GitHub Repo stars 2026-04-03

20 OptionToStringGenerator Nuget GitHub Repo stars 2024-02-15

21 Pekspro.DataAnnotationValuesExtractor Nuget GitHub Repo stars 2026-02-15

22 Program Nuget GitHub Repo stars 2025-11-06

23 QueryStringGenerator Nuget GitHub Repo stars 2024-11-07

24 RSCG_Decorator Nuget GitHub Repo stars 2023-09-30

25 RSCG_UtilityTypes NugetNuget GitHub Repo stars 2023-12-22

26 StaticReflection NugetNuget GitHub Repo stars 2023-10-13

27 SyncMethodGenerator Nuget GitHub Repo stars 2023-08-14

28 System.Runtime.InteropServices Nuget GitHub Repo stars 2023-04-16

29 System.Text.RegularExpressions Nuget GitHub Repo stars 2023-04-16

30 TelemetryLogging Nuget GitHub Repo stars 2023-11-30

31 Tenekon.MethodOverloads.SourceGenerator Nuget GitHub Repo stars 2026-09-05

32 ThisClass Nuget GitHub Repo stars 2024-04-19

33 TrimItEasy Nuget GitHub Repo stars 2026-08-28

See category​

EnhancementClass