VarDump 0.2.14
See the version list below for details.
dotnet add package VarDump --version 0.2.14
NuGet\Install-Package VarDump -Version 0.2.14
<PackageReference Include="VarDump" Version="0.2.14" />
paket add VarDump --version 0.2.14
#r "nuget: VarDump, 0.2.14"
// Install VarDump as a Cake Addin #addin nuget:?package=VarDump&version=0.2.14 // Install VarDump as a Cake Tool #tool nuget:?package=VarDump&version=0.2.14
Stand with the people of Ukraine: How to Help
VarDump is a utility for serialization of runtime objects to C# or Visual Basic string.
Developed as a free alternative of ObjectDumper.NET, which is not free for commercial use.
C# & VB Dumper:
<p align="right"><a href="https://dotnetfiddle.net/4ARhwR">Run .NET fiddle</a></p>
using System;
using VarDump;
var anonymousObject = new { Name = "Name", Surname = "Surname" };
var cs = new CSharpDumper().Dump(anonymousObject);
Console.WriteLine(cs);
var vb = new VisualBasicDumper().Dump(anonymousObject);
Console.WriteLine(vb);
C# & VB Dumper, how to use DumpOptions:
<p align="right"><a href="https://dotnetfiddle.net/CxsDtN">Run .NET fiddle</a></p>
using System;
using System.ComponentModel;
using VarDump;
using VarDump.Visitor;
var person = new Person { Name = "Nick", Age = 23 };
var dumpOptions = new DumpOptions { SortDirection = ListSortDirection.Ascending };
var csDumper = new CSharpDumper(dumpOptions);
var cs = csDumper.Dump(person);
var vbDumper = new VisualBasicDumper(dumpOptions);
var vb = vbDumper.Dump(person);
// C# string
Console.WriteLine(cs);
// VB string
Console.WriteLine(vb);
class Person
{
public string Name {get; set;}
public int Age {get; set;}
}
Object Extension methods:
<p align="right"><a href="https://dotnetfiddle.net/Lz9duL">Run .NET fiddle</a></p>
using System;
using System.Linq;
using VarDump.Extensions;
using VarDump.Visitor;
var dictionary = new[]
{
new
{
Name = "Name1",
Surname = "Surname1"
}
}.ToDictionary(x => x.Name, x => x);
Console.WriteLine(dictionary.Dump(DumpOptions.Default));
Object Extension methods, how to switch default dumper to VB:
<p align="right"><a href="https://dotnetfiddle.net/sM1lML">Run .NET fiddle</a></p>
using System;
using System.Linq;
using VarDump.Extensions;
using VarDump.Visitor;
VarDumpExtensions.VarDumpFactory = VarDumpFactories.VisualBasic;
var dictionary = new[]
{
new
{
Name = "Name1",
Surname = "Surname1"
}
}.ToDictionary(x => x.Name, x => x);
Console.WriteLine(dictionary.Dump(DumpOptions.Default));
Extensibility:
<p align="right"><a href="https://dotnetfiddle.net/hfrbo6">Run .NET fiddle</a></p>
using System;
using System.Collections.Generic;
using VarDump;
using VarDump.Visitor;
using VarDump.Visitor.Descriptors;
// For more examples see https://github.com/ycherkes/VarDump/blob/main/test/VarDump.UnitTests/ObjectDescriptorMiddlewareSpec.cs
const string name = "World";
FormattableString formattableString = $"Hello, {name}";
var dumpOptions = new DumpOptions
{
Descriptors = { new FormattableStringMiddleware() }
};
var csDumper = new CSharpDumper(dumpOptions);
var cs = csDumper.Dump(formattableString);
var vbDumper = new VisualBasicDumper(dumpOptions);
var vb = vbDumper.Dump(formattableString);
// C# string
Console.WriteLine(cs);
// VB string
Console.WriteLine(vb);
class FormattableStringMiddleware : IObjectDescriptorMiddleware
{
public IEnumerable<IReflectionDescriptor> Describe(object @object, Type objectType, Func<IEnumerable<IReflectionDescriptor>> prev)
{
if (@object is FormattableString fs)
{
return Descriptor.FromObject(new
{
fs.Format,
Arguments = fs.GetArguments()
});
}
return prev();
}
}
For more examples see Unit Tests
Powered By
Repository | License |
---|---|
Heavily customized version of System.CodeDom |
Privacy Notice: No personal data is collected at all.
This tool has been working well for my personal needs, but outside that its future depends on your feedback. Feel free to open an issue.
Any donations during this time will be directed to local charities at my own discretion.
Product | Versions 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 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 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. 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. |
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on VarDump:
Package | Downloads |
---|---|
VarDump.Extensions
Extension methods for simplifying the usage of the VarDump library. |
|
Frank.Reflection.Dump
This is a library that allows you to dump the contents of a type to a string as initilization code. This is helpful for debugging and logging, and can be used to generate code especially for unit tests. |
|
Frank.LinqPad.VarDump
Frank's LINQPad VarDump extensions are a set of extensions to LINQPad that makes it easier to dump variables in LINQPad queries as initialized C# code. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.5.15 | 102 | 10/23/2024 |
1.0.4.13 | 1,026 | 8/15/2024 |
1.0.4.12 | 140 | 6/8/2024 |
1.0.4.11 | 647 | 6/3/2024 |
1.0.3 | 215 | 4/2/2024 |
1.0.2 | 165 | 3/31/2024 |
1.0.1 | 181 | 3/17/2024 |
1.0.0 | 169 | 3/17/2024 |
0.2.16 | 195 | 2/14/2024 |
0.2.15 | 154 | 1/24/2024 |
0.2.14 | 886 | 1/20/2024 |
0.2.13 | 139 | 1/20/2024 |
0.2.12 | 285 | 1/7/2024 |
0.2.11 | 487 | 12/30/2023 |
0.2.10 | 171 | 12/29/2023 |
0.2.9 | 175 | 12/29/2023 |
0.2.8 | 130 | 12/10/2023 |
0.2.7 | 140 | 12/3/2023 |
0.2.6 | 220 | 9/9/2023 |
0.2.5 | 193 | 8/5/2023 |
0.2.4 | 154 | 7/29/2023 |
0.2.3 | 167 | 7/23/2023 |
0.2.2 | 175 | 7/3/2023 |
0.2.1 | 171 | 7/2/2023 |
0.2.0 | 165 | 7/1/2023 |
0.1.0 | 3,268 | 4/17/2023 |
0.0.9 | 183 | 4/5/2023 |
0.0.8 | 209 | 4/3/2023 |
0.0.7 | 244 | 3/5/2023 |
0.0.6 | 280 | 1/27/2023 |
0.0.5 | 283 | 1/27/2023 |
0.0.4 | 277 | 1/26/2023 |
0.0.3 | 297 | 1/21/2023 |
0.0.2 | 283 | 1/20/2023 |
0.0.1 | 307 | 1/20/2023 |