Package Description
License
—
Deps
0
Install Size
—
Vulns
✓ 0
Published
Dec 15, 2025
$ dotnet add package TypeFest.NetEver wish C# had some of the utility types that TypeScript has? This library is the one for you.
Just like you've come to love from TypeScript, this attribute allows you to pick properties off of another type to create another one. If the type of one of the properties in the source type changes so will they in the target type.
Example:
namespace Test;
public class Todo
{
public string Title { get; set; }
public int Description { get; set; }
public bool Completed { get; set; }
}
[Pick<Todo>("Title", "Completed")]
public partial class TodoPreview;
Under the hood, a type with the Title and Completed just like they are on Todo.
namespace Test;
public class Todo
{
public string Title { get; set; }
public int Description { get; set; }
public bool Completed { get; set; }
public DateTime CreatedAt { get; set; }
}
[Omit<Todo>("Description")]
public partial class TodoPreview;
Just like Pick, this will create you a type but with all the defined properties removed.
Because this library makes use of C# source generators that means that the properties added to the type aren't accessible to other C# source generators. This is mainly a problem if you want to use these types with JSON source generation or configuration source generator. The properties won't be visible to them and they will not work they way you want. The best fix for this is some sort of framework to ensure some source generators work before others. But no such framework exists today, if you have ideas for one, please create an issue with it and link back to this issue and feel free to use this library as an example.