MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

Query support enum description mapping

Open shps951023 opened this issue 4 years ago • 0 comments

image

void Main()
{
	var value = new[] { 
		new Dto{Name="Jack",Type=UserType.General},
		new Dto{Name="Leo",Type=UserType.Admin},
	};
	var path = Path.GetTempPath() + Guid.NewGuid() + ".xlsx";
	Console.WriteLine(path);
	
	MiniExcel.SaveAs(path,value);
	
	var rows = MiniExcel.Query<Dto>(path);
	Console.WriteLine(rows);
}

// You can define other methods, fields, classes and namespaces here
public class Dto
{
	public string Name { get; set; }	
	public UserType Type { get; set; }
}

public enum UserType
{
	[Description("General User")]
	General,
	[Description("Administrator")]
	Admin
}

shps951023 avatar Sep 14 '21 05:09 shps951023