Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ Visualize Public

Adds debugger attributes to help visualize objects.

License

Notifications You must be signed in to change notification settings

Fody/Visualize

Repository files navigation

Chat on Gitter NuGet Status

This is an add-in for Fody

Visualize Icon - An eye

Adds debugger attributes to help visualize objects.

Usage

See also Fody usage.

NuGet installation

Install the Visualize.Fody NuGet package and update the Fody NuGet package:

PM> Install-Package Visualize.Fody
PM> Update-Package Fody

The Update-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.

Add to FodyWeavers.xml

Add <Visualize/> to FodyWeavers.xml

<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
  <Visualize/>
</Weavers>

Your Code

public class Example1
{
    public string Name { get; set; }
    public int Number { get; set; }
}

public class Example2 : IEnumerable<int>
{
    public IEnumerator<int> GetEnumerator()
    {
        return Enumerable.Range(0, 10).GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}

What gets compiled

[DebuggerDisplay("Name = {Name} | Number = {Number}")]
public class Example1
{
    public string Name { get; set; }
    public int Number { get; set; }
}

[DebuggerTypeProxy(typeof(<Example2>Proxy))]
public class Example2 : IEnumerable<int>
{
    private sealed class <Example2>Proxy
    {
        private readonly Example2 original;

        public <Example2>Proxy(Example2 original)
        {
            this.original = original;
        }

        public int[] Items
        {
            get { return new List<int>(original).ToArray(); }
        }
    }

    public IEnumerator<int> GetEnumerator()
    {
        return Enumerable.Range(0, 10).GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}

Links

Icon

Eye designed by Nicolas Ramallo from The Noun Project

About

Adds debugger attributes to help visualize objects.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 6

Languages