Repository navigation
Expand file tree
/
Copy pathPropertySearchResult.cs
More file actions
108 lines (97 loc) · 2.83 KB
/
Copy pathPropertySearchResult.cs
File metadata and controls
108 lines (97 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSModuleDevelopment.Utility
{
/// <summary>
/// The result object returned by Search-PSMDPropertyValue
/// </summary>
[Serializable]
public class PropertySearchResult
{
/// <summary>
/// Path notation on nested properties
/// </summary>
public string Path
{
get
{
return String.Join(".", PathElements);
}
set { }
}
/// <summary>
/// The name of the property found
/// </summary>
public string Name;
/// <summary>
/// The full name of the property
/// </summary>
public string FullName
{
get
{
if (PathElements.Length > 0)
return String.Format("{0}.{1}", Path, Name);
return Name;
}
set { }
}
/// <summary>
/// Individual property names on a found nested property.
/// </summary>
public string[] PathElements = new string[0];
/// <summary>
/// The actual value found
/// </summary>
public object Value;
/// <summary>
/// The type of the value found
/// </summary>
public Type Type
{
get
{
if (Value != null)
return Value.GetType();
return null;
}
set { }
}
/// <summary>
/// How deeply nested was the property found.
/// </summary>
public int Depth
{
get { return PathElements.Length; }
set { }
}
/// <summary>
/// The original input object
/// </summary>
public object InputObject;
/// <summary>
/// Creates an empty object. Only used for serialization support.
/// </summary>
public PropertySearchResult()
{
}
/// <summary>
/// Creates a full report object from using Search-PSMDPropertyValue
/// </summary>
/// <param name="Name">The name of the property</param>
/// <param name="PathElements">The path elements if it is a nested property</param>
/// <param name="Value">The actual value found</param>
/// <param name="InputObject">The original input object offered to the command.</param>
public PropertySearchResult(string Name, string[] PathElements, object Value, object InputObject)
{
this.Name = Name;
if (PathElements != null)
this.PathElements = PathElements;
this.Value = Value;
this.InputObject = InputObject;
}
}
}