Beispiel #1
0
 public PSMemberSet(string name, IEnumerable <PSMemberInfo> members)
 {
     this.inheritMembers = true;
     if (string.IsNullOrEmpty(name))
     {
         throw PSTraceSource.NewArgumentException("name");
     }
     base.name = name;
     if (members == null)
     {
         throw PSTraceSource.NewArgumentNullException("members");
     }
     this.internalMembers = new PSMemberInfoInternalCollection <PSMemberInfo>();
     foreach (PSMemberInfo info in members)
     {
         if (info == null)
         {
             throw PSTraceSource.NewArgumentNullException("members");
         }
         this.internalMembers.Add(info.Copy());
     }
     this.members    = new PSMemberInfoIntegratingCollection <PSMemberInfo>(this, emptyMemberCollection);
     this.properties = new PSMemberInfoIntegratingCollection <PSPropertyInfo>(this, emptyPropertyCollection);
     this.methods    = new PSMemberInfoIntegratingCollection <PSMethodInfo>(this, emptyMethodCollection);
 }
Beispiel #2
0
 public PSMemberSet(string name)
 {
     this.name            = !string.IsNullOrEmpty(name) ? name : throw PSMemberSet.tracer.NewArgumentException(nameof(name));
     this.internalMembers = new PSMemberInfoInternalCollection <PSMemberInfo>();
     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);
 }
Beispiel #3
0
 internal PSMemberSet(string name, PSObject mshObject)
 {
     this.name = !string.IsNullOrEmpty(name) ? name : throw PSMemberSet.tracer.NewArgumentException(nameof(name));
     this.constructorPSObject = mshObject != null ? mshObject : throw PSMemberSet.tracer.NewArgumentNullException(nameof(mshObject));
     this.internalMembers     = mshObject.InstanceMembers;
     this.members             = new PSMemberInfoIntegratingCollection <PSMemberInfo>((object)this, PSMemberSet.typeMemberCollection);
     this.properties          = new PSMemberInfoIntegratingCollection <PSPropertyInfo>((object)this, PSMemberSet.typePropertyCollection);
     this.methods             = new PSMemberInfoIntegratingCollection <PSMethodInfo>((object)this, PSMemberSet.typeMethodCollection);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
 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 });
         }
     }
 }
Beispiel #7
0
 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);
 }