Trarizon.Library 1.1.0.13

dotnet add package Trarizon.Library --version 1.1.0.13
                    
NuGet\Install-Package Trarizon.Library -Version 1.1.0.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Trarizon.Library" Version="1.1.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trarizon.Library" Version="1.1.0.13" />
                    
Directory.Packages.props
<PackageReference Include="Trarizon.Library" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Trarizon.Library --version 1.1.0.13
                    
#r "nuget: Trarizon.Library, 1.1.0.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Trarizon.Library@1.1.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Trarizon.Library&version=1.1.0.13
                    
Install as a Cake Addin
#tool nuget:?package=Trarizon.Library&version=1.1.0.13
                    
Install as a Cake Tool

Trarizon.Library

Miscellaneous Helpers This library use nuget package CommunityToolkit.HighPerformance and CommunityToolkit.Diagnostics

Contents:

CodeAnalysis

  • [ExternalSealed] : Indicates a type or interface cannot be inherited or implemented by types in another assembly
  • [BackingFieldAccess] : a workround of .NET 9 backing field
  • [FriendAccess] : Opt-in ver of friend in c++

CodeGeneration

  • [Singleton] : Generate a singleton class, thread safe with static field
  • [OptionalOut] : Mark it on a out parameter, a method with same signature without the out parameter will be generated
    • Currently does not support multiple out parameters

Wrappers

  • Either<,> : Monad either
  • LazyInitDisposable : Wrapper for fully utilizing the using statement when lazy-init IDisposable objects.
  • Result<,> : Monad Result, for smaller size, TError only supports reference type, and if TError is null, the result means success
  • Optional<> : Monad Option

More

The namespace structure is almost the same with System.XXX

  • namespace Buffer
    • ObjectPool : Object pool
    • IObjectAllcator : Interface for object allocator
  • namespace Components
    • EventBus : A event bus implementation
    • IFlagNotifiable : Interface for notification, a cheaper and stricter INotifyPropertyChanged
      • FlagNotifiable : Extensions and static methods for global notification
      • FlagNotifiable<>/<,> : Abstract classes that implements IFlagNotifiable and provide a method InvokeNotification, not thread-safe
      • FlagNotifier : Designed as a field to help implements IFlagNotifiable
  • namespace IO
    • TraPath : Extends System.IO.Path
    • TraStream : Helpers for System.IO.Stream
  • namespace Mathematics
    • BoundedInterval : Represents a interval
    • Interval : Represents a left-close, right-open interval
    • Rational : Rational number
    • TraGeometry : Helpers for Vector2/3, Quaternion, etc.
    • TraIndex : Helpers for Index, Range
    • TraNumber : Helpers for number types (in System.Numerics)
    • Geometry2D/Geometry3D
      • Line2D
      • LineSegment2D
      • Ray2D/3D
  • namespace Text
    • TraString : Helper for string
    • namespace Json
      • WeakJsonElement : Wrapper of JsonElement that auto check JsonValueKind
  • namespace Threading
    • AsyncSemaphoreLock : Async lock implemented with SemaphoreSlim
    • TraAsync : Helpers for async operation, Task<>, ValueTask<>, etc.
  • TraDelegate : Helpers for delegates
  • TraEnum : Helpers for enum types
  • TraRandom : Helpers for Random
  • TraTuple : Helpers for ValueTuples
  • TraUnsafe : Extends Unsafe

Helpers

  • ArrayPool
    • Rent : Overload for ArrayPool<>.Rent, returns a auto-return object avaible with using statement
  • Path
    • IsValidFile/PathName : check validation of file/path name, with SearchValues
    • ReplaceInvalidFileNameChar : Replace invalid file name characters
  • Stream
    • Read(Exactly) : Read data into unmanaged span
    • ReadExactlyIntoArray : Read exactly data into an unmanaged array with specific length
    • ReadWithInt32Prefix : Read a int as array length, and do ReadExactlyIntoArray
  • String
    • CreateAsSpan : Create string by <see cref="DefaultInterpolatedStringHandler"/>, directly return inner ReadOnlySpan without allocate string
    • (Try)Unescape : Unescape string
  • Number
    • IncAnd(Try)Wrap : Increment the number, if the result is greater than given max, then wrap it
    • Normalize : Linear normalize value into [0,1]
    • NormalizeUnclamped : Linear normalize value into [0,1], but not clamped
    • MapTo : Linear map a value from [a, b] to [c, d], no clamp
    • FlipNegative : if (value < 0) value = ~value, useful on BinarySearch result
    • Min/Max : Overloads for params ReadOnlySpan<>
    • MinMax(T, T) : Reorder input 2 args
    • MinMax(ROS<T>) : Get min and max in one iteration
    • GetCheckedOffset : Index.GetOffset with overflow check
    • ValidateSliceArgs : Check if start and length is valid within a collection
  • Geometry
    • ToNormalized : Normalize Vector2/3, Quaternion
    • ToEulerAngles
  • Async
    • GetAwaiter : Support await keyword for ValueTask?, ValueTask<>?
    • CatchCancallation : Return a awaitable that will catch TaskCancellationException.
  • Delegate
    • Create : Create delegate with an object and a static method. It is actually the way compiler use to create delegate for extension methods.
  • Enum
    • HasAnyFlag : Check if a enum value has one of given flags.
  • Random
    • SelectWeight : Weighted random
    • NextSingle/Double : Get a random float number in specific range
    • NextBoolean : Get a random boolean value
    • NextItem : Get a random item in collection
  • Unsafe
    • AsReadOnly : Perform Unsafe.As for ref readonly variables
  • Utils
    • SetField : If given value is not equals to field, set value and return true, otherwise return false
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0.13 522 5/2/2025 1.1.0.13 is deprecated because it has critical bugs.
1.0.0 205 2/25/2025