Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ignatandrei/RSCG_UtilityTypes
Omit and Pick from TypeScript : https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys
https://github.com/ignatandrei/RSCG_UtilityTypes
Last synced: 3 months ago
JSON representation
Omit and Pick from TypeScript : https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys
- Host: GitHub
- URL: https://github.com/ignatandrei/RSCG_UtilityTypes
- Owner: ignatandrei
- License: mit
- Created: 2023-12-22T18:01:44.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-06T22:32:15.000Z (10 months ago)
- Last Synced: 2024-07-29T03:56:32.333Z (3 months ago)
- Language: C#
- Size: 20.5 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- RSCG_Examples - https://github.com/ignatandrei/RSCG_UtilityTypes
- csharp-source-generators - RSCG_UtilityTypes - ![stars](https://img.shields.io/github/stars/ignatandrei/RSCG_UtilityTypes?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/ignatandrei/RSCG_UtilityTypes?style=flat-square&cacheSeconds=86400) Add Omit and Pick attributes to generate classes from existing class, like in TypeScript. (Source Generators / Functional Programming)
README
# 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
```xml
```
In C# 9.0
```csharp
[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
# More Roslyn Source Code Generators
You can find more RSCG with examples at [Roslyn Source Code Generators](https://ignatandrei.github.io/RSCG_Examples/v2/)