本文整理汇总了C#中System.Management.Automation.PSObject.GetSerializationDepth方法的典型用法代码示例。如果您正苦于以下问题:C# PSObject.GetSerializationDepth方法的具体用法?C# PSObject.GetSerializationDepth怎么用?C# PSObject.GetSerializationDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Management.Automation.PSObject
的用法示例。
在下文中一共展示了PSObject.GetSerializationDepth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDepthOfSerialization
private static int GetDepthOfSerialization(PSObject source, int depth)
{
if (source == null)
{
return depth;
}
int serializationDepth = source.GetSerializationDepth(null);
if (serializationDepth <= 0)
{
return depth;
}
return serializationDepth;
}
示例2: GetDepthOfSerialization
/// <summary>
/// compute the serialization depth for an PSObject instance subtree
/// </summary>
/// <param name="source">PSObject whose serialization depth has to be computed</param>
/// <param name="depth">current depth</param>
/// <returns></returns>
private static int GetDepthOfSerialization(PSObject source, int depth)
{
if (source == null)
return depth;
// get the depth from the PSObject
// NOTE: we assume that the depth out of the PSObject is > 0
// else we consider it not set in types.ps1xml
int objectLevelDepth = source.GetSerializationDepth(null);
if (objectLevelDepth <= 0)
{
// no override at the type level
return depth;
}
return objectLevelDepth;
}