Universal.Common 8.2.5

dotnet add package Universal.Common --version 8.2.5                
NuGet\Install-Package Universal.Common -Version 8.2.5                
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="Universal.Common" Version="8.2.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Universal.Common --version 8.2.5                
#r "nuget: Universal.Common, 8.2.5"                
#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.
// Install Universal.Common as a Cake Addin
#addin nuget:?package=Universal.Common&version=8.2.5

// Install Universal.Common as a Cake Tool
#tool nuget:?package=Universal.Common&version=8.2.5                

Universal.Common

Support utilities and extensions meant to extend the default functionality from the base class library.

Quickstart

BitSequence

Utility for as-is bit manipulations.

BitSequence bs1 = new BitSequence("10001010"); // Binary representation in string.
BitSequence bs2 = new BitSequence(new bool[] { true, false, true }); // As booleans.
BitSequence bs3 = bs1 & "11110000"; // Bitwise and, implicit conversion from binary representation string.

BitStream

Utility to perform bit-level operations on System.IO.Stream.

using (BitStream bitStream = new BitStream(stream)) 
{
    uint value = bitStream.ReadUInt32(4); // Reads 4 bits from the stream and interprets it as an unsigned integer, padding if necessary.
}

MediaType

Represents MIME types and provides functionality for working with media types in various contexts.

Constructor
MediaType mediaType = new MediaType("application/json");
MediaType Detection

The MediaType class provides several static methods to create MediaType instances from different sources:

  1. FromExtension
MediaType mediaType = MediaType.FromExtension(".json");
// Returns a MediaType instance for "application/json"

Creates a MediaType instance based on a file extension (with or without the leading dot).

  1. FromByteArray
byte[] fileBytes = File.ReadAllBytes("sample.png");
MediaType mediaType = MediaType.FromByteArray(fileBytes);
// Returns a MediaType instance for "image/png"

Detects the media type based on the file signature in the byte array.

  1. FromStream
using (FileStream stream = File.OpenRead("sample.jpg"))
{
    MediaType mediaType = MediaType.FromStream(stream);
    // Returns a MediaType instance for "image/jpeg"
}

Detects the media type based on the file signature read from the stream.

These methods allow for flexible media type detection from various sources, making it easier to work with files and data streams in different formats.

UriBuilder

Derived from System.UriBuilder, this class provides a fluent API to configure segments and queries.

UriBuilder uriBuilder = new UriBuilder("http://www.myhost.com");
uriBuilder
    .AddSegments("api", "Product", 1)
    .AddQuery("key", "value");
// "https://www.myhost.com/api/Product/1?key=value"

ZigZag

Static class that encodes arrays to matrices and vice-versa.

int[,] matrix = new int[,] { { 0, 1 }, { 2, 3 } };
int[] array = ZigZag.ToArray(matrix); // [0, 1, 2, 3]
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 was computed.  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. 
.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.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (33)

Showing the top 5 NuGet packages that depend on Universal.Common:

Package Downloads
Universal.Common.Reflection

Class library for performing advanced operations with types, dynamic objects, expressions, and reflection.

Universal.Common.Net.Http

Class library to build clients and work with HTTP web services.

Universal.Common.Serialization

Class library with base objects that provide serializable to and from XML and JSON strings and binary serialization using the native binary formatter.

Universal.Android

Class library for accelerating Xamarin.Android development. Note: If you encounter layout inflation exceptions (could be masked as NotFoundException, or some issue with text_color_secondary.xml etc), make sure you define colorControlNormal and use a style with that attribute defined.

Universal.Common.Mathematics

Class library implementing advanced mathematical algorithms, transforms, and time series manipulations. Implementations favour simplicity and correctness.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.2.5 136 10/17/2024
8.2.4.1 384 7/15/2024
8.2.4 11,679 9/25/2023
8.2.3 446 6/8/2023
8.2.2 2,525 11/23/2022
8.2.1 375 11/22/2022
8.2.0 9,630 9/14/2022
8.1.2 19,874 10/24/2021
8.1.1 456 10/23/2021
8.1.0 461 10/23/2021
8.0.0 12,452 10/13/2021
7.7.1 7,131 8/24/2021
7.7.0 395 8/24/2021
7.6.2 440 8/19/2021
7.6.1 13,012 6/17/2021
7.6.0 2,040 6/3/2021
7.5.7 2,433 4/30/2021
7.5.6 436 4/29/2021
7.5.5 682 4/13/2021
7.5.4 4,420 3/31/2021
7.5.3 5,705 3/21/2021
7.5.2 1,290 3/15/2021
7.5.1 875 2/16/2021
7.5.0 24,236 2/5/2021
7.4.6 483 2/2/2021
7.4.5.1 1,976 1/15/2021
7.4.5 1,107 1/13/2021
7.4.4 1,657 1/7/2021
7.4.3 2,004 12/16/2020
7.4.2.1 553 12/15/2020
7.4.2 521 12/9/2020
7.4.1 5,425 11/26/2020
7.4.0 512 11/26/2020
7.3.5 2,795 11/23/2020
7.3.4 1,771 11/11/2020
7.3.3 548 11/11/2020
7.3.2 1,332 11/1/2020
7.3.1.1 4,689 10/19/2020
7.3.1 529 10/15/2020
7.3.0 529 10/15/2020
7.2.2 3,491 9/29/2020
7.2.1 664 9/29/2020
7.2.0 536 9/29/2020
7.1.1.1 598 9/28/2020
7.1.1 634 9/25/2020
7.1.0 1,772 9/2/2020
7.0.0 6,218 8/24/2020
6.4.7 612 8/21/2020
6.4.6 605 8/21/2020
6.4.5 19,857 5/21/2020
6.4.4 1,875 5/12/2020
6.4.3 2,065 4/23/2020
6.4.2 556 4/20/2020
6.4.1.2 17,701 3/20/2020
6.4.1.1 616 3/20/2020
6.4.1 606 3/20/2020
6.4.0 5,872 2/25/2020
6.3.5 1,217 2/21/2020
6.3.4 673 2/21/2020
6.3.3 3,674 2/11/2020
6.3.2 671 2/11/2020
6.3.1.1 7,180 1/23/2020
6.3.0 4,219 12/18/2019
6.2.7 2,069 12/17/2019
6.2.6 1,299 12/4/2019
6.2.5 805 12/4/2019
6.2.4 3,433 12/1/2019
6.2.3 10,382 10/25/2019
6.2.2 3,494 10/8/2019
6.2.1 1,051 10/7/2019
6.2.0.1 5,369 9/25/2019
6.2.0 1,772 9/20/2019
6.1.5 3,144 9/16/2019
6.1.4.1 1,677 9/9/2019
6.1.4 2,112 9/3/2019
6.1.3 629 9/2/2019
6.1.2 817 8/28/2019
6.1.1 7,563 7/9/2019
6.1.0.1 28,365 7/5/2019
6.1.0 16,879 5/7/2019
6.0.6 1,807 5/3/2019
6.0.5 1,326 5/2/2019
6.0.4 4,707 4/24/2019
6.0.3 986 4/24/2019
6.0.2 7,791 3/22/2019
6.0.1.2 2,365 3/12/2019
6.0.1.1 844 3/12/2019
6.0.1 851 3/11/2019
6.0.0 1,631 3/6/2019
5.3.6 784 3/5/2019
5.3.5 752 3/5/2019
5.3.4 1,837 3/4/2019
5.3.3 1,455 2/28/2019
5.3.2 1,274 2/27/2019
5.3.1.1 876 2/25/2019
5.3.1 765 2/25/2019
5.3.0 725 2/25/2019
5.2.1 3,318 2/16/2019
5.2.0.1 3,818 2/7/2019
5.1.8 801 2/7/2019
5.1.7.1 1,037 1/30/2019
5.1.7 806 1/30/2019
5.1.6.1 821 1/24/2019
5.1.6 789 1/23/2019
5.1.5 792 1/23/2019
5.1.4.2 845 1/18/2019
5.1.3 1,545 1/14/2019
5.1.2 7,608 1/8/2019
5.1.1.1 820 1/8/2019
5.1.1 807 1/6/2019
5.1.0 1,380 1/2/2019
5.0.2 839 12/31/2018
5.0.1.1 825 12/31/2018
5.0.1 816 12/31/2018
5.0.0.1 950 12/14/2018
5.0.0 2,113 12/10/2018
4.2.5 876 11/23/2018
4.2.4 896 11/23/2018
4.2.3.1 862 11/22/2018
4.2.3 846 11/22/2018
4.2.2.2 1,115 11/19/2018
4.2.2.1 7,896 10/2/2018
4.2.2 934 10/1/2018
4.2.1.2 949 10/1/2018
4.2.1.1 929 9/27/2018
4.2.1 863 9/26/2018
4.2.0.5 925 9/26/2018
4.2.0.4 907 9/25/2018
4.2.0.3 929 9/25/2018
4.2.0.2 956 9/25/2018
4.2.0.1 911 9/25/2018
4.2.0 1,044 9/24/2018
4.1.0 883 9/21/2018
4.0.0.6 923 9/18/2018
4.0.0.5 959 9/18/2018
4.0.0.4 933 9/17/2018
4.0.0.3 3,252 9/7/2018
4.0.0.2 1,205 9/4/2018
4.0.0.1 1,309 9/4/2018
4.0.0 4,105 8/30/2018
3.2.0 2,809 8/28/2018
3.1.0 933 8/28/2018
3.0.6 2,514 8/27/2018
3.0.5 916 8/27/2018
3.0.4 946 8/27/2018
3.0.3 957 8/24/2018
3.0.2 1,146 8/24/2018
3.0.1.2 929 8/23/2018
3.0.1.1 977 8/21/2018
3.0.1 947 8/21/2018
3.0.0 1,865 8/16/2018
2.2.1 1,022 8/15/2018
2.2.0 971 8/14/2018
2.1.0 970 8/13/2018
2.0.2 996 8/7/2018
2.0.1 1,247 5/10/2018
2.0.0 1,833 4/26/2018
1.5.3.7 3,060 1/27/2018
1.5.3.6 1,129 1/15/2018
1.5.3.5 1,105 1/8/2018
1.5.3.4 1,107 1/3/2018
1.5.3.3 1,127 1/3/2018
1.5.3.2 1,116 12/27/2017
1.5.3.1 1,143 12/25/2017
1.5.3 1,077 12/25/2017
1.5.2 1,098 12/24/2017
1.5.1 1,118 12/23/2017
1.5.0 1,071 12/22/2017
1.4.7 965 12/2/2017
1.4.6 2,596 11/28/2017
1.4.5 1,155 11/28/2017
1.4.0 1,227 11/12/2017
1.3.5 3,887 11/8/2017
1.3.4 1,223 11/8/2017
1.3.3 1,285 11/2/2017
1.3.2 1,215 11/2/2017
1.3.1 1,256 9/12/2017
1.3.0 1,168 8/26/2017
1.2.1 1,054 8/23/2017
1.2.0 1,120 8/17/2017
1.1.1 1,051 8/17/2017
1.1.0 1,052 8/17/2017
1.0.0 1,865 8/12/2017

MediaType detection now also works with streams.