/// <summary> /// Retrieves all the members available in the object. /// The adapter implementation is encouraged to cache all properties/methods available /// in the first call to GetMember and GetMembers so that subsequent /// calls can use the cache. /// In the case of the .NET adapter that would be a cache from the .NET type to /// the public properties and fields available in that type. /// In the case of the DirectoryEntry adapter, this could be a cache of the objectClass /// to the properties available in it. /// </summary> /// <param name="obj">Object to get all the member information from.</param> /// <returns>All members in obj.</returns> protected override PSMemberInfoInternalCollection <T> GetMembers <T>(object obj) { // obj should never be null Diagnostics.Assert(obj != null, "Input object is null"); ManagementBaseObject wmiObject = (ManagementBaseObject)obj; PSMemberInfoInternalCollection <T> returnValue = new PSMemberInfoInternalCollection <T>(); AddAllProperties <T>(wmiObject, returnValue); AddAllMethods <T>(wmiObject, returnValue); return(returnValue); }
protected override void DoAddAllProperties <T>(object obj, PSMemberInfoInternalCollection <T> members) { DataRow row = (DataRow)obj; if ((row.Table != null) && (row.Table.Columns != null)) { foreach (DataColumn column in row.Table.Columns) { members.Add(new PSProperty(column.ColumnName, this, obj, column.ColumnName) as T); } } }
public PSMemberSet(string name) { this.inheritMembers = true; if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } base.name = name; this.internalMembers = new PSMemberInfoInternalCollection <PSMemberInfo>(); this.members = new PSMemberInfoIntegratingCollection <PSMemberInfo>(this, emptyMemberCollection); this.properties = new PSMemberInfoIntegratingCollection <PSPropertyInfo>(this, emptyPropertyCollection); this.methods = new PSMemberInfoIntegratingCollection <PSMethodInfo>(this, emptyMethodCollection); }
/// <summary> /// Serializes properties of PSObject. /// </summary> private void WritePSObjectProperties(PSObject source, int depth) { Dbg.Assert(source != null, "caller should validate the information"); depth = GetDepthOfSerialization(source, depth); //Depth available for each property is one less --depth; Dbg.Assert(depth >= 0, "depth should be greater or equal to zero"); if (source.GetSerializationMethod(null) == SerializationMethod.SpecificProperties) { PSMemberInfoInternalCollection <PSPropertyInfo> specificProperties = new PSMemberInfoInternalCollection <PSPropertyInfo>(); foreach (string propertyName in source.GetSpecificPropertiesToSerialize(null)) { PSPropertyInfo property = source.Properties[propertyName]; if (property != null) { specificProperties.Add(property); } } SerializeProperties(specificProperties, CustomSerializationStrings.Properties, depth); return; } foreach (PSPropertyInfo prop in source.Properties) { Dbg.Assert(prop != null, "propertyCollection should only have member of type PSProperty"); object value = AutomationNull.Value; //PSObject throws GetValueException if it cannot //get value for a property. try { value = prop.Value; } catch (GetValueException) { WritePropertyWithNullValue(_writer, prop, depth); continue; } //Write the property if (value == null) { WritePropertyWithNullValue(_writer, prop, depth); } else { WriteOneObject(value, prop.Name, depth); } } }
protected override void AddAllMethods <T>(ManagementBaseObject wmiObject, PSMemberInfoInternalCollection <T> members) { if (typeof(T).IsAssignableFrom(typeof(PSMethod))) { foreach (BaseWMIAdapter.WMIMethodCacheEntry entry in BaseWMIAdapter.GetInstanceMethodTable(wmiObject, false).memberCollection) { if (members[entry.Name] == null) { Adapter.tracer.WriteLine("Adding method {0}", new object[] { entry.Name }); members.Add(new PSMethod(entry.Name, this, wmiObject, entry) as T); } } } }
protected override PSMemberInfoInternalCollection <T> GetMembers <T>( object obj) { PSMemberInfoInternalCollection <T> internalCollection = new PSMemberInfoInternalCollection <T>(); foreach (PSMemberInfo member1 in ((PSObject)obj).Members) { if (member1 is T member) { internalCollection.Add(member); } } return(internalCollection); }
protected override void AddAllProperties <T>(ManagementBaseObject wmiObject, PSMemberInfoInternalCollection <T> members) { // Add System properties base.AddAllProperties(wmiObject, members); if (wmiObject.Properties != null) { foreach (PropertyData property in wmiObject.Properties) { members.Add(new PSProperty(property.Name, this, wmiObject, property) as T); } } }
protected override PSMemberInfoInternalCollection <T> GetMembers <T>(object obj) { PSMemberInfoInternalCollection <T> internals = new PSMemberInfoInternalCollection <T>(); foreach (PSMemberInfo info in ((PSMemberSet)obj).Members) { T member = info as T; if (member != null) { internals.Add(member); } } return(internals); }
protected override void DoAddAllProperties <T>( object obj, PSMemberInfoInternalCollection <T> members) { DataRow dataRow = (DataRow)obj; if (dataRow.Table == null || dataRow.Table.Columns == null) { return; } foreach (DataColumn column in (InternalDataCollectionBase)dataRow.Table.Columns) { members.Add(new PSProperty(column.ColumnName, (Adapter)this, obj, (object)column.ColumnName) as T); } }
private PSMemberInfoInternalCollection <T> GetInternalMembers( MshMemberMatchOptions matchOptions) { PSMemberInfoInternalCollection <T> internalCollection = new PSMemberInfoInternalCollection <T>(); foreach (T obj in (PSMemberInfoCollection <T>) this) { PSMemberInfo psMemberInfo = (PSMemberInfo)obj; if (psMemberInfo.MatchesOptions(matchOptions) && psMemberInfo is T member) { internalCollection.Add(member); } } return(internalCollection); }
/// <summary> /// Retrieves all the properties available in the object. /// </summary> /// <param name="obj">object to get all the property information from</param> /// <param name="members">collection where the members will be added</param> protected override void DoAddAllProperties <T>(object obj, PSMemberInfoInternalCollection <T> members) { DataRow dataRow = (DataRow)obj; if (dataRow.Table == null || dataRow.Table.Columns == null) { return; } foreach (DataColumn property in dataRow.Table.Columns) { members.Add(new PSProperty(property.ColumnName, this, obj, property.ColumnName) as T); } return; }
private PSMemberInfoInternalCollection <T> GetInternalMembers(MshMemberMatchOptions matchOptions) { PSMemberInfoInternalCollection <T> internals = new PSMemberInfoInternalCollection <T>(); lock (this.members) { foreach (T local in this.members.Values.OfType <T>()) { if (local.MatchesOptions(matchOptions)) { internals.Add(local); } } } return(internals); }
internal PSMemberSet(string name, PSObject mshObject) { this.inheritMembers = true; if (string.IsNullOrEmpty(name)) { throw PSTraceSource.NewArgumentException("name"); } base.name = name; if (mshObject == null) { throw PSTraceSource.NewArgumentNullException("mshObject"); } this.constructorPSObject = mshObject; this.internalMembers = mshObject.InstanceMembers; this.members = new PSMemberInfoIntegratingCollection <PSMemberInfo>(this, typeMemberCollection); this.properties = new PSMemberInfoIntegratingCollection <PSPropertyInfo>(this, typePropertyCollection); this.methods = new PSMemberInfoIntegratingCollection <PSMethodInfo>(this, typeMethodCollection); }
protected override PSMemberInfoInternalCollection <T> GetMembers <T>( object obj) { using (ComAdapter.tracer.TraceMethod()) { ComTypeInfo typeInfo = this.GetTypeInfo(); PSMemberInfoInternalCollection <T> internalCollection = new PSMemberInfoInternalCollection <T>(); if (typeInfo != null) { bool flag1 = typeof(T).IsAssignableFrom(typeof(PSProperty)); bool flag2 = typeof(T).IsAssignableFrom(typeof(PSParameterizedProperty)); if (flag1 || flag2) { foreach (ComProperty comProperty in typeInfo.Properties.Values) { if (comProperty.IsParameterized) { if (flag2) { internalCollection.Add(new PSParameterizedProperty(comProperty.Name, (Adapter)this, obj, (object)comProperty) as T); } } else if (flag1) { internalCollection.Add(new PSProperty(comProperty.Name, (Adapter)this, obj, (object)comProperty) as T); } } } if (typeof(T).IsAssignableFrom(typeof(PSMethod))) { foreach (ComMethod comMethod in typeInfo.Methods.Values) { PSMethod psMethod = new PSMethod(comMethod.Name, (Adapter)this, obj, (object)comMethod); if (!internalCollection.hashedMembers.Contains((object)comMethod.Name)) { internalCollection.Add(psMethod as T); } } } } return(internalCollection); } }
private void WritePSObjectProperties(PSObject source, int depth) { depth = GetDepthOfSerialization(source, depth); depth--; if (source.GetSerializationMethod(null) == SerializationMethod.SpecificProperties) { PSMemberInfoInternalCollection <PSPropertyInfo> propertyCollection = new PSMemberInfoInternalCollection <PSPropertyInfo>(); foreach (string str in source.GetSpecificPropertiesToSerialize(null)) { PSPropertyInfo member = source.Properties[str]; if (member != null) { propertyCollection.Add(member); } } this.SerializeProperties(propertyCollection, "Property", depth); } else { foreach (PSPropertyInfo info2 in source.Properties) { object obj2 = AutomationNull.Value; try { obj2 = info2.Value; } catch (GetValueException) { this.WritePropertyWithNullValue(this._writer, info2, depth); continue; } if (obj2 == null) { this.WritePropertyWithNullValue(this._writer, info2, depth); } else { this.WriteOneObject(obj2, info2.Name, depth); } } } }
public PSMemberSet(string name, IEnumerable <PSMemberInfo> members) { this.name = !string.IsNullOrEmpty(name) ? name : throw PSMemberSet.tracer.NewArgumentException(nameof(name)); if (members == null) { throw PSMemberSet.tracer.NewArgumentNullException(nameof(members)); } this.internalMembers = new PSMemberInfoInternalCollection <PSMemberInfo>(); foreach (PSMemberInfo member in members) { if (member == null) { throw PSMemberSet.tracer.NewArgumentNullException(nameof(members)); } this.internalMembers.Add(member.Copy()); } this.members = new PSMemberInfoIntegratingCollection <PSMemberInfo>((object)this, PSMemberSet.emptyMemberCollection); this.properties = new PSMemberInfoIntegratingCollection <PSPropertyInfo>((object)this, PSMemberSet.emptyPropertyCollection); this.methods = new PSMemberInfoIntegratingCollection <PSMethodInfo>((object)this, PSMemberSet.emptyMethodCollection); }
internal Enumerator(PSMemberInfoIntegratingCollection <S> integratingCollection) { using (PSObject.memberResolution.TraceScope("Enumeration Start", new object[0])) { this.currentIndex = -1; this.current = default(S); this.allMembers = integratingCollection.GetIntegratedMembers(MshMemberMatchOptions.None); if (integratingCollection.mshOwner != null) { integratingCollection.GenerateAllReservedMembers(); PSObject.memberResolution.WriteLine("Enumerating PSObject with type \"{0}\".", new object[] { integratingCollection.mshOwner.ImmediateBaseObject.GetType().FullName }); PSObject.memberResolution.WriteLine("PSObject instance members: {0}", new object[] { this.allMembers.VisibleCount }); } else { PSObject.memberResolution.WriteLine("Enumerating PSMemberSet \"{0}\".", new object[] { integratingCollection.memberSetOwner.Name }); PSObject.memberResolution.WriteLine("MemberSet instance members: {0}", new object[] { this.allMembers.VisibleCount }); } } }
private PSMemberInfoInternalCollection<PSMemberInfo> GetInternalMembersFromAdapted() { PSMemberInfoInternalCollection<PSMemberInfo> internals = new PSMemberInfoInternalCollection<PSMemberInfo>(); if (this.psObject.isDeserialized) { if (this.psObject.adaptedMembers != null) { foreach (PSMemberInfo info in this.psObject.adaptedMembers) { internals.Add(info.Copy()); } } return internals; } foreach (PSMemberInfo info2 in this.psObject.InternalAdapter.BaseGetMembers<PSMemberInfo>(this.psObject.ImmediateBaseObject)) { internals.Add(info2.Copy()); } return internals; }
private void SerializeProperties(PSMemberInfoInternalCollection <PSPropertyInfo> propertyCollection, string name, int depth) { if (propertyCollection.Count != 0) { foreach (PSMemberInfo info in propertyCollection) { PSPropertyInfo info2 = info as PSPropertyInfo; object source = AutomationNull.Value; try { source = info2.Value; } catch (GetValueException) { continue; } this.WriteOneObject(source, info2.Name, depth); } } }
/// <summary> /// Retrieves all the members available in the object. /// The adapter implementation is encouraged to cache all properties/methods available /// in the first call to GetMember and GetMembers so that subsequent /// calls can use the cache. /// In the case of the .NET adapter that would be a cache from the .NET type to /// the public properties and fields available in that type. /// In the case of the DirectoryEntry adapter, this could be a cache of the objectClass /// to the properties available in it. /// </summary> /// <param name="obj">object to get all the member information from</param> /// <returns>all members in obj</returns> protected override PSMemberInfoInternalCollection <T> GetMembers <T>(object obj) { PSMemberInfoInternalCollection <T> collection = new PSMemberInfoInternalCollection <T>(); bool lookingForProperties = typeof(T).IsAssignableFrom(typeof(PSProperty)); bool lookingForParameterizedProperties = typeof(T).IsAssignableFrom(typeof(PSParameterizedProperty)); if (lookingForProperties || lookingForParameterizedProperties) { foreach (ComProperty prop in _comTypeInfo.Properties.Values) { if (prop.IsParameterized) { if (lookingForParameterizedProperties) { collection.Add(new PSParameterizedProperty(prop.Name, this, obj, prop) as T); } } else if (lookingForProperties) { collection.Add(new PSProperty(prop.Name, this, obj, prop) as T); } } } bool lookingForMethods = typeof(T).IsAssignableFrom(typeof(PSMethod)); if (lookingForMethods) { foreach (ComMethod method in _comTypeInfo.Methods.Values) { if (collection[method.Name] == null) { PSMethod mshmethod = new PSMethod(method.Name, this, obj, method); collection.Add(mshmethod as T); } } } return(collection); }
protected override void DoAddAllProperties <T>(object obj, PSMemberInfoInternalCollection <T> members) { System.Xml.XmlNode node = (System.Xml.XmlNode)obj; Dictionary <string, List <System.Xml.XmlNode> > dictionary = new Dictionary <string, List <System.Xml.XmlNode> >(StringComparer.OrdinalIgnoreCase); if (node.Attributes != null) { foreach (System.Xml.XmlNode node2 in node.Attributes) { List <System.Xml.XmlNode> list; if (!dictionary.TryGetValue(node2.LocalName, out list)) { list = new List <System.Xml.XmlNode>(); dictionary[node2.LocalName] = list; } list.Add(node2); } } if (node.ChildNodes != null) { foreach (System.Xml.XmlNode node3 in node.ChildNodes) { if (!(node3 is XmlWhitespace)) { List <System.Xml.XmlNode> list2; if (!dictionary.TryGetValue(node3.LocalName, out list2)) { list2 = new List <System.Xml.XmlNode>(); dictionary[node3.LocalName] = list2; } list2.Add(node3); } } } foreach (KeyValuePair <string, List <System.Xml.XmlNode> > pair in dictionary) { members.Add(new PSProperty(pair.Key, this, obj, pair.Value.ToArray()) as T); } }
protected override void DoAddAllProperties <T>( object obj, PSMemberInfoInternalCollection <T> members) { XmlNode xmlNode = (XmlNode)obj; Dictionary <string, List <XmlNode> > dictionary = new Dictionary <string, List <XmlNode> >((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); if (xmlNode.Attributes != null) { foreach (XmlNode attribute in (XmlNamedNodeMap)xmlNode.Attributes) { List <XmlNode> xmlNodeList; if (!dictionary.TryGetValue(attribute.LocalName, out xmlNodeList)) { xmlNodeList = new List <XmlNode>(); dictionary[attribute.LocalName] = xmlNodeList; } xmlNodeList.Add(attribute); } } if (xmlNode.ChildNodes != null) { foreach (XmlNode childNode in xmlNode.ChildNodes) { List <XmlNode> xmlNodeList; if (!dictionary.TryGetValue(childNode.LocalName, out xmlNodeList)) { xmlNodeList = new List <XmlNode>(); dictionary[childNode.LocalName] = xmlNodeList; } xmlNodeList.Add(childNode); } } foreach (KeyValuePair <string, List <XmlNode> > keyValuePair in dictionary) { members.Add(new PSProperty(keyValuePair.Key, (Adapter)this, obj, (object)keyValuePair.Value.ToArray()) as T); } }
protected override void DoAddAllProperties <T>(object obj, PSMemberInfoInternalCollection <T> members) { Collection <PSAdaptedProperty> properties = null; try { properties = this.externalAdapter.GetProperties(obj); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); throw new ExtendedTypeSystemException("PSPropertyAdapter.GetProperties", exception, ExtendedTypeSystem.GetProperties, new object[] { obj.ToString() }); } if (properties == null) { throw new ExtendedTypeSystemException("PSPropertyAdapter.NullReturnValueError", null, ExtendedTypeSystem.NullReturnValueError, new object[] { "PSPropertyAdapter.GetProperties" }); } foreach (PSAdaptedProperty property in properties) { this.InitializeProperty(property, obj); members.Add(property as T); } }
/// <summary> /// Adds method information of the ManagementObject. Only instance methods are added for /// a ManagementObject. /// </summary> /// <typeparam name="T">PSMemberInfo</typeparam> /// <param name="wmiObject">Object for which the members need to be retrieved.</param> /// <param name="members">Method information is added to this.</param> protected override void AddAllMethods <T>(ManagementBaseObject wmiObject, PSMemberInfoInternalCollection <T> members) { Diagnostics.Assert((wmiObject != null) && (members != null), "Input arguments should not be null."); if (!typeof(T).IsAssignableFrom(typeof(PSMethod))) { return; } CacheTable table; table = GetInstanceMethodTable(wmiObject, false); foreach (WMIMethodCacheEntry methodEntry in table.memberCollection) { if (members[methodEntry.Name] == null) { tracer.WriteLine("Adding method {0}", methodEntry.Name); members.Add(new PSMethod(methodEntry.Name, this, wmiObject, methodEntry) as T); } } }
protected override PSMemberInfoInternalCollection <T> GetMembers <T>(object obj) { PSMemberInfoInternalCollection <T> internals = new PSMemberInfoInternalCollection <T>(); bool flag = typeof(T).IsAssignableFrom(typeof(PSProperty)); bool flag2 = typeof(T).IsAssignableFrom(typeof(PSParameterizedProperty)); if (flag || flag2) { foreach (ComProperty property in this._comTypeInfo.Properties.Values) { if (property.IsParameterized) { if (flag2) { internals.Add(new PSParameterizedProperty(property.Name, this, obj, property) as T); } } else if (flag) { internals.Add(new PSProperty(property.Name, this, obj, property) as T); } } } if (typeof(T).IsAssignableFrom(typeof(PSMethod))) { foreach (ComMethod method in this._comTypeInfo.Methods.Values) { if (internals[method.Name] == null) { PSMethod method2 = new PSMethod(method.Name, this, obj, method); internals.Add(method2 as T); } } } return(internals); }
/// <summary> /// Adds method information of the ManagementObject. This is done by accessing /// the ManagementClass corresponding to this ManagementObject. All the method /// information is cached for a particular ManagementObject. /// </summary> /// <typeparam name="T">PSMemberInfo</typeparam> /// <param name="wmiObject">Object for which the members need to be retrieved.</param> /// <param name="members">Method information is added to this.</param> protected abstract void AddAllMethods <T>(ManagementBaseObject wmiObject, PSMemberInfoInternalCollection <T> members) where T : PSMemberInfo;
protected abstract void DoAddAllProperties <T>(object obj, PSMemberInfoInternalCollection <T> members) where T : PSMemberInfo;
private void HandleComplexTypePSObject ( object source, string property, int depth, out CimInstance result ) { List <CimInstance> listOfCimInstancesProperties = null; Dbg.Assert(source != null, "caller should validate the parameter"); PSObject mshSource = PSObject.AsPSObject(source); // Figure out what kind of object we are dealing with bool isErrorRecord = false; bool isInformationalRecord = false; bool isEnum = false; bool isPSObject = false; //TODO, insivara : To be implemented //bool isCimInstance = false; if (!mshSource.immediateBaseObjectIsEmpty) { ErrorRecord errorRecord = mshSource.ImmediateBaseObject as ErrorRecord; if (errorRecord == null) { InformationalRecord informationalRecord = mshSource.ImmediateBaseObject as InformationalRecord; if (informationalRecord == null) { isEnum = mshSource.ImmediateBaseObject is Enum; isPSObject = mshSource.ImmediateBaseObject is PSObject; } else { informationalRecord.ToPSObjectForRemoting(mshSource); isInformationalRecord = true; } } else { errorRecord.ToPSObjectForRemoting(mshSource); isErrorRecord = true; } } bool writeToString = true; if (mshSource.ToStringFromDeserialization == null) // continue to write ToString from deserialized objects, but... { if (mshSource.immediateBaseObjectIsEmpty) // ... don't write ToString for property bags { writeToString = false; } } // This will create a CimInstance for PS_Object and populate the typenames. result = CreateCimInstanceForPSObject(cimClassName: "PS_Object", psObj: mshSource, writeToString: writeToString); PSMemberInfoInternalCollection <PSPropertyInfo> specificPropertiesToSerialize = SerializationUtilities.GetSpecificPropertiesToSerialize(mshSource, AllPropertiesCollection, _typeTable); if (isEnum) { CimInstance enumCimInstance = CreateCimInstanceForEnum(mshSource, depth, property != null); CimProperty p = CimProperty.Create("Value", enumCimInstance, Microsoft.Management.Infrastructure.CimType.Reference, Microsoft.Management.Infrastructure.CimFlags.Property); result.CimInstanceProperties.Add(p); } else if (isPSObject) { CimInstance psObjectCimInstance; CreateCimInstanceForOneObject(mshSource.ImmediateBaseObject, property, depth, out psObjectCimInstance); CimProperty valueProperty = CimProperty.Create("Value", psObjectCimInstance, Microsoft.Management.Infrastructure.CimType.Reference, Microsoft.Management.Infrastructure.CimFlags.Property); result.CimInstanceProperties.Add(valueProperty); } else if (isErrorRecord || isInformationalRecord) { // nothing to do } else { CreateCimInstanceForPSObjectProperties(mshSource, depth, specificPropertiesToSerialize, out listOfCimInstancesProperties); } //TODO, insivara : Implement serialization of CimInstance //if (isCimInstance) //{ // CimInstance cimInstance = mshSource.ImmediateBaseObject as CimInstance; // PrepareCimInstanceForSerialization(mshSource, cimInstance); //} //TODO, insivara : ExtendedProperties implementation will be done in a subsequent checkin //SerializeExtendedProperties(mshSource, depth, specificPropertiesToSerialize, out listOfCimInstancesExtendedProperties); if (listOfCimInstancesProperties != null && listOfCimInstancesProperties.Count > 0) { CimInstance[] referenceArray = listOfCimInstancesProperties.ToArray(); CimProperty properties = CimProperty.Create("Properties", referenceArray, Microsoft.Management.Infrastructure.CimType.ReferenceArray, Microsoft.Management.Infrastructure.CimFlags.Property); result.CimInstanceProperties.Add(properties); } }
private PSMemberInfoInternalCollection <T> GetIntegratedMembers(MshMemberMatchOptions matchOptions) { using (PSObject.memberResolution.TraceScope("Generating the total list of members", new object[0])) { object mshOwner; PSMemberInfoInternalCollection <T> internals = new PSMemberInfoInternalCollection <T>(); if (this.mshOwner != null) { mshOwner = this.mshOwner; foreach (PSMemberInfo info in this.mshOwner.InstanceMembers) { if (info.MatchesOptions(matchOptions)) { T member = info as T; if (member != null) { internals.Add(member); } } } } else { mshOwner = this.memberSetOwner.instance; foreach (PSMemberInfo info2 in this.memberSetOwner.InternalMembers) { if (info2.MatchesOptions(matchOptions)) { T local2 = info2 as T; if (local2 != null) { info2.ReplicateInstance(mshOwner); internals.Add(local2); } } } } if (mshOwner != null) { mshOwner = PSObject.AsPSObject(mshOwner); foreach (CollectionEntry <T> entry in this.collections) { foreach (T local3 in entry.GetMembers((PSObject)mshOwner)) { PSMemberInfo info3 = internals[local3.Name]; if (info3 != null) { PSObject.memberResolution.WriteLine("Member \"{0}\" of type \"{1}\" has been ignored because a member with the same name and type \"{2}\" is already present.", new object[] { local3.Name, local3.MemberType, info3.MemberType }); } else if (!local3.MatchesOptions(matchOptions)) { PSObject.memberResolution.WriteLine("Skipping hidden member \"{0}\".", new object[] { local3.Name }); } else { T local4; if (entry.ShouldCloneWhenReturning) { local4 = (T)local3.Copy(); } else { local4 = local3; } if (entry.ShouldReplicateWhenReturning) { local4.ReplicateInstance(mshOwner); } internals.Add(local4); } } } } return(internals); } }
internal ReadOnlyPSMemberInfoCollection(PSMemberInfoInternalCollection <T> members) => this.members = members != null ? members : throw ReadOnlyPSMemberInfoCollection <T> .tracer.NewArgumentNullException(nameof(members));