当前位置: 首页>>代码示例>>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;未经允许,请勿转载。