Imato.Reflection
1.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Imato.Reflection --version 1.0.6
NuGet\Install-Package Imato.Reflection -Version 1.0.6
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="Imato.Reflection" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Imato.Reflection --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Imato.Reflection, 1.0.6"
#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 Imato.Reflection as a Cake Addin #addin nuget:?package=Imato.Reflection&version=1.0.6 // Install Imato.Reflection as a Cake Tool #tool nuget:?package=Imato.Reflection&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Imato.Reflection
- read public object data as dictionary ([property] = value)
- test object equality
- compare object and get differences as dictionary ([property] = value)
- desalinize object to JSON or CSV string
Examples
// Same object
using Imato.Reflection;
private TestClass testObj = new TestClass
{
Id = 1,
Name = "Test 1",
Date = DateTime.Parse("2022-08-03"),
Flag = false,
Test = new Nested
{
SubId = 2,
Name = "Test 2"
}
};
// Read object data as dictionary
var result = testObj.GetFields();
Assert.AreEqual(6, result.Count);
Assert.True(result.ContainsKey("Name"));
Assert.True(result.ContainsKey("Test.Name"));
Assert.True(result.ContainsKey("Test.SubId"));
// Get differences
var obj1 = new TestClass
{
Id = 1,
Name = "Test 1",
Date = DateTime.Parse("2022-08-03"),
Flag = false
};
var obj2 = new TestClass
{
Id = 1,
Name = "Test 2",
Date = DateTime.Parse("2022-08-03"),
Flag = false
};
var diff = obj1.GetDiff(obj2);
Assert.AreEqual(1, diff.Count);
Assert.AreEqual("Test 1", diff["Name"]);
// Test equality
Assert.IsFalse(obj1.IsEqual(obj2));
// Serialization
var json = testObj.ToJson();
var csv = testObj.ToCsv()
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. net9.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- FastMember (>= 1.5.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Imato.Reflection:
Package | Downloads |
---|---|
Imato.Dapper.DbContext
Base DbContext for MS SQL, Postgres, MySql |
|
Imato.Data.External
Utils for import data |
GitHub repositories
This package is not used by any popular GitHub repositories.
Ready to use