我有一个输出用户定义对象的 cmdlet Metric。
Metric类有数据成员:
Count- 类型int16Dimension- 类型List<MetricDimension>
MetricDimension是具有数据成员的用户定义对象:
Name- 类型StringOperatorProperty- 类型StringValues- 类型List<String>
当我输出我的 Metric 对象时,会显示以下输出。
尺寸:{Dim1,Dim2}
数量:2
我想要的是它应该显示对象 ( MetricDimension) 的完整详细信息,包括OperatorProperty&Values列表,而不仅仅是Name.
是否可以显示维度对象的每个属性?
// Summary:
// Specifies a metric dimension.
public class MetricDimension
{
public MetricDimension();
public MetricDimension(string name, string operatorProperty, IList<string> values);
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "operator")]
public string OperatorProperty { get; set; }
[JsonProperty(PropertyName = "values")]
public IList<string> Values { get; set; }
public virtual void Validate();
}
public class Metric
{
public Metric();
public Metric(int16 count, MetricDimension dimension);
[JsonProperty(PropertyName = "count")]
public int16 Count { get; set; }
[JsonProperty(PropertyName = "dimension")]
public IList<MetricDimension> Dimension{ get; set; }
}