pawelgerr / thinktecture.runtime.extensions Goto Github PK
View Code? Open in Web Editor NEWProvides an easy way to implement Smart Enums and Value Objects
License: BSD 3-Clause "New" or "Revised" License
Provides an easy way to implement Smart Enums and Value Objects
License: BSD 3-Clause "New" or "Revised" License
Add annotation when "TKey : notnull" when Rider supports it.
Adding the annotation now breaks the intelli-sense making it difficult to code.
Is your feature request related to a problem? Please describe.
I want to minimise dependencies in my project by utilising framework dependencies wherever possible
Describe the solution you'd like
I want the package to not have an explicit dependency on System.Text.Json as it can be provided by the framework.
Describe alternatives you've considered
Accept the additional dependency
Additional context
n/a
Hi Pawel,
using updated version now causes this error:
'IEnumerable' does not contain a definition for 'ToList' and no accessible extension method 'ToList' accepting a first argument of type 'MySmartEnum' could be found (are you missing a using directive or an assembly reference?)
using Thinktecture;
namespace MyNamespace;
public partial class MySmartEnum : IEnum<string>
{
public static readonly MySmartEnum MyItem = new("MyItem");
}
See MyNamespace.MySmartEnum.g.cs:
/* file: MyNamespace.MySmartEnum.g.cs */
/// <summary>
/// Gets all valid items.
/// </summary>
public static global::System.Collections.Generic.IReadOnlyList<global::MyNamespace.MySmartEnum> Items => _items ??= ItemsLookup.Values.ToList().AsReadOnly();
Greetings,
David
Hi Pawel,
implementing your SmartEnum with static readonly field named System causes error:
'MySmartEnum' does not contain a definition for 'StringComparer' and no accessible extension method 'StringComparer' accepting a first argument of type 'MySmartEnum' could be found (are you missing a using directive or an assembly reference?)
using Thinktecture;
namespace MyNamespace;
public partial class MySmartEnum : IEnum<string>
{
public static readonly MySmartEnum System = new("System");
public static readonly MySmartEnum User = new("User");
}
In the generated source file MySmartEnum_Generated.cs arises a conflict between System.StringComparer and the field named System.
I am using Thinktecture.Runtime.Extensions v4.0.1.
Best regards,
David
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.