Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A polyfill-like package that is focused on making it easier to work around missing features, rather than provide hacky attempts at implementing them.

License

Unknown, Unknown licenses found

Licenses found

Unknown
license.md
Unknown
license-dotnet.md
Notifications You must be signed in to change notification settings

Owl-Domain/Polyease

Repository files navigation

OwlDomain.Polyease

A status badge of the main Nuget package for the project. A status badge of the Github action workflow for building the project. A status badge of the Github action workflow for testing the project. A status badge of the Github action workflow for testing the AOT compatibility of the project. A status badge of the Github action workflow for linting the project. A status badge of the Github action workflow for publishing the project.

Status badge for the OwlDomain discord server.


A polyfill-like package that is focused on making it easier to work around missing features, rather than provide hacky attempts at implementing them. The main purpose of this is to make it easier to write multi-targeting libraries.

An example of the spirit of this library is the CallerArgumentExpressionAttribute, under normal usage, the compiler provides the expression that was passed in for a different parameter as a string, some polyfill libraries try to imitate that behaviour, however this library will only provide a replica of the attribute class in order to make multi-targeting easier.

Installation

To use this package simply reference it from your .NET project, which will download the specified version from the nuget.org source.

In a C# project (a .csproj file) that would look like this:

<ItemGroup>
  <PackageReference Include="OwlDomain.Polyease" Version="1.4.2" />
</ItemGroup>

For the best results, use multi-targeting in your project, and then use conditional expressions to ensure that the package is only referenced when necessary.

In C#, that would look like this:

<PropertyGroup>
  <TargetFrameworks>net7.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>

<!-- simpler when you only need to check a single target -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
  <PackageReference Include="OwlDomain.Polyease" Version="1.4.2" />
</ItemGroup>

<!-- or a different way that's simpler when you need to check for all targets compatible with a specific one -->
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
  <PackageReference Include="OwlDomain.Polyease" Version="1.4.2" />
</ItemGroup>

The reason for this is that if you wanted to use the UnreachableException in your library code, and you were multi-targeting .NET Standard 2.1 and .NET 7, then when your library was being used under .NET Standard 2.1 the OwlDomain.Polyease package would become a dependency and would be required by your package, however if your library was being used under .NET 7 then the OwlDomain.Polyease package would not be referenced, and therefore it would never be a dependency.

The conditional expressions are not strictly necessary for the package to work, as the OwlDomain.Polyease package uses conditional compilation to ensure that the poly-eased features are only present when they are missing. However using the conditional expressions helps to keep your dependencies clean.

Usage

To use this package in your code, simply reference it, nothing else specific has to be done in order to use it, as the poly-eased features are placed in the same namespaces as the official versions.

Development

Currently this project is being developed on the develop branch, changes will be merged to main (the default branch) whenever there is a package update.

Contributions

Code contributions will not be accepted, however feel free to provide feedback / suggestions by creating a new issue, or look at the existing issues to see if your concern / suggestion has already been raised.

License

This project (the source, and the release files, e.t.c) is released under the OwlDomain License.

Parts of this project are copied / derived under the MIT license from the .NET Foundation and Contributors, you can read their full license here.

About

A polyfill-like package that is focused on making it easier to work around missing features, rather than provide hacky attempts at implementing them.

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
license.md
Unknown
license-dotnet.md

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •