考慮以下結構:應用實例的一維陣列上的操作在一行中,使用LINQ
internal struct Coordinate
{
public Double Top { get; set; }
public Double Left { get; set; }
}
internal struct Dimension
{
public Double Height { get; set; }
public Double Width { get; set; }
}
internal struct Property
{
public Boolean Visible { get; set; }
internal String Label { get; set; }
public String Value { get; set; }
internal Coordinate Position { get; set; }
public Dimension Dimensions { get; set; }
}
我需要操縱性能的20種左右的情況下。我想這樣做盡可能幹淨...是否可以在一行代碼中對屬性的數組應用多個操作?
我想沿着線的東西:
new []
{
InstanceOfProperty,
InstanceOfProperty,
InstanceOfProperty ...
}.Each(p => p.Dimensions.Height = 100.0);
使用類而不是結構,它應該工作正常 – 2010-09-01 13:18:35