Skip to content

Commit

Permalink
Merge branch 'PublicFastNewOption' of https://github.com/Nyrest/FastG…
Browse files Browse the repository at this point in the history
…enericNew into PublicFastNewOption
  • Loading branch information
Nyrest committed Aug 15, 2024
2 parents 59458db + 9871e58 commit cd3f9da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
9.0.x
include-prerelease: true
Expand All @@ -50,11 +49,15 @@ jobs:
3.1.x
5.0.x
6.0.x
8.0.x
9.0.x
include-prerelease: true
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore -p:NoWarn=CS1591
- name: Test Again
run: dotnet test -c Release --no-build --no-restore --verbosity normal
- name: Pack
run: dotnet pack -o publishOutput -c Release --no-restore --no-build --verbosity normal
# Runs a set of commands using the runners shell
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<a href="https://github.com/Nyrest/FastGenericNew"><img height="320" src="https://github.com/Nyrest/FastGenericNew/raw/main/Assets/FastGenericNew-Wide.svg"></a>

<a href="https://github.com/Nyrest/FastGenericNew/actions/workflows/tests.yml"><img src="https://img.shields.io/github/workflow/status/Nyrest/FastGenericNew/Tests?style=for-the-badge"></a>
<a href="https://github.com/Nyrest/FastGenericNew/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/Nyrest/FastGenericNew/tests.yml?style=for-the-badge"></a>
<a href="https://www.nuget.org/packages/FastGenericNew/"><img src="https://img.shields.io/nuget/vpre/FastGenericNew?style=for-the-badge&color=0065b3"></a>
<a href="https://www.nuget.org/packages/FastGenericNew.SourceGenerator/"><img src="https://img.shields.io/nuget/vpre/FastGenericNew.SourceGenerator?label=SourceGenerator&style=for-the-badge&color=0065b3"></a>
</div>
Expand All @@ -17,15 +17,15 @@
- Non-Public Constructor Support
- No Generic Constraints
- Compatible with .NET Standard 2.0
- Multiple backend implementations.
- Multiple backend implementations
- Heavily tested on Win/Mac/Linux

- 🪛 **Modern** Compiler Integration
- Source Generator v2 (Incremental Generator)
- Highly Configurable ([Props](https://github.com/Nyrest/FastGenericNew/wiki/SourceGenerator-Options))
- Multi-threaded Generation

- 🔥 **Lastest** C#/.NET Features Support
- 🔥 **Latest** C#/.NET Features Support
- [C# 8 Nullable](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types) Support
- [C# 10 Parameterless struct constructors](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/parameterless-struct-constructors) Support (Both invokes or not)
- WebAssembly Support
Expand Down Expand Up @@ -76,7 +76,7 @@ var obj2 = FastNew.CreateInstance<T, string>("text");
var obj3 = FastNew.CreateInstance<T, string, int>("text", 0);

// Try pattern
// NOTE: Try pattern will only check the constructor could be called (exist & callable)
// NOTE: The try pattern will only check if the constructor can be called.
// It will not catch or handle any exceptions thrown in the constructor.
if (FastNew.TryCreateInstance<T, string>("arg0", out T result));
{
Expand All @@ -90,8 +90,8 @@ if (FastNew.TryCreateInstance<T, string>("arg0", out T result));
> the constraint is `where T : new()` but appears to **ignore the parameterless constructor if the constraint is `where T : struct`**.
> **But `FastNew.CreateInstance<T>()` will always invoke the parameterless constructor if it's available.**
>
> If you don't want to invoke the parameterless constructor of **ValueType**.
> Consider to use `FastNew.NewOrDefault<T>()` which **will never invoke the parameterless constructor of `ValueType`**
> If you don't want to invoke the parameterless constructor of **ValueType**,
> consider using `FastNew.NewOrDefault<T>()` which **will never invoke the parameterless constructor of `ValueType`**
## 🚀 Benchmark

Expand Down

0 comments on commit cd3f9da

Please sign in to comment.