Soenneker.Extensions.Object 4.0.4299

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Extensions.Object --version 4.0.4299
                    
NuGet\Install-Package Soenneker.Extensions.Object -Version 4.0.4299
                    
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="Soenneker.Extensions.Object" Version="4.0.4299" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.Object" Version="4.0.4299" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.Object" />
                    
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 Soenneker.Extensions.Object --version 4.0.4299
                    
#r "nuget: Soenneker.Extensions.Object, 4.0.4299"
                    
#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 Soenneker.Extensions.Object@4.0.4299
                    
#: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=Soenneker.Extensions.Object&version=4.0.4299
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.Object&version=4.0.4299
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.Object

A collection of helpful Object extension methods.

Installation

dotnet add package Soenneker.Extensions.Object

Quick start

using Soenneker.Extensions.Object;

// Given an existing object named obj:
var result = obj.IsObjectNumeric();

Common operations

  • IsObjectNumeric() - Determines whether the specified object is of a numeric type.
  • ThrowIfNull() - Throws an ArgumentNullException if the input object is null.
  • ToDictionary() - Converts an object's public instance properties into a dictionary. Uses JsonPropertyNameAttribute if present for the key. Only declared properties (not inherited) are included. Optimized for low allocations and high performance. Returns a dictionary of property names (or JSON names) to values.
  • ToQueryStringViaReflection() - Uses Reflection to build a query string out of an object. If object is null, returns an empty string. Uses the object's property names as the keys of the query string.
  • ToQueryString() - Builds a query string from cached property accessors. Uses the object's property name OR 'JsonPropertyName' attribute as the keys of the query string. Escapes the value. Uses JSON-compatible property names and scalar formatting without serializing the containing object.
  • LogNullProperties() - Logs any properties of the given object that are null.
  • LogNullPropertiesRecursivelyAsJson() - Logs the properties of an object that are null, including nested objects, as a JSON string.
  • ToReadableString() - Converts an object into a human-readable string representation, including its public properties. Returns a formatted string representation of the object's properties and their values.
  • ToFormUrlEncodedContent() - Converts an object into FormUrlEncodedContent using reflection, honoring JsonPropertyName attributes on properties. Only top-level, readable instance properties are included.
  • ToHttpContent() - Converts an object to an HttpContent with JSON content using JsonUtil.WebOptions. Returns an HttpContent containing the JSON representation of the object. If the object is null, returns an HttpContent with empty content. This method does not log the result.
  • ToHttpContentWithKey() - Serializes an object to JSON, constructs an HttpContent, and adds an 'x-api-key' header to the request. Returns an HttpContent instance containing the serialized JSON content with the specified 'x-api-key' header added.
  • TryToHttpContent() - Attempts to convert an object to an HttpContent with JSON content, logging any serialization errors. Returns an HttpContent containing the JSON representation of the object, or null if serialization fails.

The package also includes one additional operation for more specialized cases.

Usage

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Soenneker.Extensions.Object:

Package Downloads
Soenneker.Extensions.HttpClient

A collection of helpful HttpClient extension methods, like retry and auto (de)serialization

Soenneker.Blazor.Utils.InteropEventListener

Manages the registration, removal, and disposal of .NET object references used for interop event listeners.

Soenneker.Blazor.ApiClient

A lightweight and efficient API client wrapper for Blazor applications, simplifying HTTP communication with support for asynchronous calls, cancellation tokens, and JSON serialization.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.4310 0 8/30/2026
4.0.4308 0 8/30/2026
4.0.4307 0 8/30/2026
4.0.4306 0 8/30/2026
4.0.4305 0 8/30/2026
4.0.4303 0 8/29/2026
4.0.4302 30 8/29/2026
4.0.4300 55 8/29/2026
4.0.4299 39 8/29/2026
4.0.4298 958 8/26/2026
4.0.4297 434 8/26/2026
4.0.4296 51 8/26/2026
4.0.4295 503 8/26/2026
4.0.4294 36 8/26/2026
4.0.4293 178 8/25/2026
4.0.4292 43 8/25/2026
4.0.4291 1,213 8/22/2026
4.0.4290 560 8/22/2026
4.0.4289 347 8/22/2026
4.0.4287 808 8/21/2026
Loading failed

Improve README documentation