Item
클래스는 여러 가지 다른 회원이
IEnumerable<Item>
를 반환하는 쿼리를 작성했습니다
: 나는 LINQPad는 결과 테이블의 컬럼에 Item
속성을 할당 선택한 순서를 좋아하지 않는다LINQPad - IEnumerable <MyObject>을 렌더링 할 때 열 순서를 제어 하시겠습니까?
public class Item
{
public string Name { get; private set; }
public string Type { get; private set; }
public IEnumerable<Property> Properties;
public IEnumerable<Item> Items;
public Item(XElement itemElement)
{
Name = itemElement.Attribute("name").Value;
Type = itemElement.Attribute("type").Value;
Properties = from property in itemElement.Elements("Property")
select new Property(property);
Items = from item in itemElement.Elements("Item")
select new Item(item);
}
}
을 . 열이 Name
, Type
, Properties
, Items
의 순서로 표시되기를 원하지만 LINQPad 기본값은 Properties
, Items
, Name
, Type
입니다. 속성 열이 있어야하는 순서를 LINQPad에 알 수있는 방법이 있습니까?
시도'추가 {얻을; set;}'을 속성과'Type'으로 설정하여 속성을 만듭니다 - 테이블을 생성하는 코드는 필드를 먼저 순환 한 다음 속성을 반복 할 수 있습니다. 또는 [custom visualizer] (http://www.linqpad.net/customvisualizers.aspx)를 작성할 수도 있습니다. –