镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

SaveAs by empty IEnumerable<T> without header #133

Closed

Description

@shps951023

image

Activity

  1. shps951023 commented on Mar 26, 2021

    @shps951023
    MemberAuthor

    JsonNet

    void Main()
    {
    	{
    		object rows = new List<Demo>(){ };
    		var json = JsonConvert.SerializeObject(rows);
    		Console.WriteLine(json); //[]	
    	}
    	{
    		object rows = new List<Demo>(){ new Demo{}};
    		var json = JsonConvert.SerializeObject(rows);
    		Console.WriteLine(json); //[{"MyProperty1":null,"MyProperty2":null}]
    	}
    	{
    		object rows = new List<Demo>() { new Demo {Demo2s=new List<Demo2>()} };
    		var json = JsonConvert.SerializeObject(rows);
    		Console.WriteLine(json); //[{"MyProperty1":null,"MyProperty2":null,"Demo2s":[]}]
    	}
    	{
    		object rows = new List<Demo>() { new Demo { Demo2s = new List<Demo2>() {new Demo2()} } };
    		var json = JsonConvert.SerializeObject(rows);
    		Console.WriteLine(json); //[{"MyProperty1":null,"MyProperty2":null,"Demo2s":[{"MyProperty1":null,"MyProperty2":null}]}]
    	}
    }
    
    // You can define other methods, fields, classes and namespaces here
    public class Demo
    {
    	public string MyProperty1 { get; set; }
    	public string MyProperty2 { get; set; }
    	public List<Demo2> Demo2s { get; set; }
    }
    
    public class Demo2
    {
    	public string MyProperty1 { get; set; }
    	public string MyProperty2 { get; set; }
    }
    
  2. shps951023 commented on Mar 28, 2021

    @shps951023
    MemberAuthor

    Now default empty Enumerable like jsonnet
    If want to have header columns need to specify generic type

    MiniExcel.SaveAs<YourType>(parameter);
  3. changed the title [-]Empty Enumerable Generic Type[/-] [+]Empty Enumerable Type without header[/+] on Apr 8, 2021
  4. changed the title [-]Empty Enumerable Type without header[/-] [+]SaveAs by empty IEnumerable<T> without header[/+] on Sep 10, 2021
  5. shps951023 commented on Sep 10, 2021

    @shps951023
    MemberAuthor

    image
    image
    image

  6. shps951023 commented on Sep 10, 2021

    @shps951023
    MemberAuthor

    v0.18.0 support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions