當前位置: 首頁>>代碼示例>>C#>>正文


C# PSCmdlet.WriteObject方法代碼示例

本文整理匯總了C#中System.Management.Automation.PSCmdlet.WriteObject方法的典型用法代碼示例。如果您正苦於以下問題:C# PSCmdlet.WriteObject方法的具體用法?C# PSCmdlet.WriteObject怎麽用?C# PSCmdlet.WriteObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Management.Automation.PSCmdlet的用法示例。


在下文中一共展示了PSCmdlet.WriteObject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ExecuteCmdletBase

        public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
        {
            ManagementService client = CreateManagementServiceClient();
            var relyingParties = client.RelyingParties;

            List<string> relyingPartyNames = new List<string>();

            foreach (var relyingParty in relyingParties)
            {
                string name = relyingParty.Name;
                relyingPartyNames.Add(name);
            }

            callingCmdlet.WriteObject(relyingPartyNames, true);
        }
開發者ID:chris-tomich,項目名稱:Glyma,代碼行數:15,代碼來源:Get_ACSRelyingPartiesBase.cs

示例2: ExecuteCmdletBase

        public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
        {
            if (Domain == null)
            {
                callingCmdlet.WriteWarning("No valid domain has been provided.");

                return;
            }

            if (!Domain.CheckIsValid())
            {
                callingCmdlet.WriteWarning("An invalid domain object has been provided.");

                return;
            }

            Model.IDatabaseInfo dbInfo = Domain;

            using (MappingToolDatabaseDataContext dataContext = new MappingToolDatabaseDataContext(dbInfo.ConnectionString))
            {
                dataContext.CommandTimeout = 180;
                if (MapId != Guid.Empty)
                {
                    /// Find maps by ID.
                    /// 

                    Model.Map map = GetMapById(dataContext, MapId);

                    callingCmdlet.WriteObject(map);
                }
                else if (!string.IsNullOrEmpty(MapName))
                {
                    /// Find maps by name.
                    /// 

                    List<Model.Map> maps = GetMapsByName(dataContext, MapName);

                    callingCmdlet.WriteObject(maps, true);
                }
                else
                {
                    /// Fine all maps.
                    /// 

                    List<Model.Map> maps = GetAllMaps(dataContext);

                    callingCmdlet.WriteObject(maps, true);
                }
            }
        }
開發者ID:chris-tomich,項目名稱:Glyma,代碼行數:50,代碼來源:Get_GLMapBase.cs

示例3: ExecuteCmdletBase

        public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
        {
            ManagementService client = CreateManagementServiceClient();
            var relyingParties = client.RelyingParties;

            List<string> relyingPartyRelayAddresses = new List<string>();

            long relyingPartyId = -1;

            foreach (var relyingParty in relyingParties)
            {
                string name = relyingParty.Name;

                if (name == RelyingParty)
                {
                    relyingPartyId = relyingParty.Id;
                }
            }

            foreach (RelyingPartyAddress address in client.RelyingPartyAddresses)
            {
                if (address.RelyingPartyId == relyingPartyId)
                {
                    relyingPartyRelayAddresses.Add(address.Address);
                }
            }

            callingCmdlet.WriteObject(relyingPartyRelayAddresses, true); ;
        }
開發者ID:chris-tomich,項目名稱:Glyma,代碼行數:29,代碼來源:Get_ACSRelyingPartyRelayAddressesBase.cs

示例4: ExecuteCmdletBase

        public void ExecuteCmdletBase(PSCmdlet callingCmdlet)
        {
            using (MappingToolDatabaseDataContext dataContext = new MappingToolDatabaseDataContext(ConnectionString))
            {
                dataContext.CommandTimeout = 180;
                if (DomainId != Guid.Empty)
                {
                    /// Find domains by domain ID.
                    /// 

                    Model.Domain domain = GetDomainById(dataContext, DomainId);

                    callingCmdlet.WriteObject(domain);
                }
                else if (!string.IsNullOrEmpty(DomainName))
                {
                    /// Find domains by domain name.
                    /// 

                    List<Model.Domain> domains = GetDomainsByName(dataContext, DomainName);

                    callingCmdlet.WriteObject(domains, true);
                }
                else
                {
                    /// Find all domains.
                    /// 

                    List<Model.Domain> domains = GetAllDomains(dataContext);

                    callingCmdlet.WriteObject(domains, true);
                }
            }
        }
開發者ID:chris-tomich,項目名稱:Glyma,代碼行數:34,代碼來源:Get_GLDomainBase.cs


注:本文中的System.Management.Automation.PSCmdlet.WriteObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。