首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在哪里可以找到Powershell .NET类型加速器的列表?

在哪里可以找到Powershell .NET类型加速器的列表?
EN

Stack Overflow用户
提问于 2009-07-17 19:47:27
回答 3查看 6.2K关注 0票数 18

在PowerShell中,您可以使用xml来表示System.Xml.XmlDocument。你知道我在哪里可以找到这些类型加速器的列表吗?

这些加速器是PowerShell专用的还是.NET专用的?

EN

回答 3

Stack Overflow用户

发布于 2009-07-18 19:59:23

最终的方法是做Oisin在这个excellent blog post中演示的事情。

代码语言:javascript
复制
PS> $acceleratorsType = [type]::gettype("System.Management.Automation.TypeAccelerators")
PS> $acceleratorsType

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
False    False    TypeAccelerators                         System.Object


PS> $acceleratorsType::Add("accelerators", $acceleratorsType)
PS> [accelerators]::Get

Key                                                         Value
---                                                         -----
int                                                         System.Int32
...

请注意,您必须向字典中添加新的'accelerators‘加速器,因为TypeAccelerators类型不是公共的。令人惊叹的是,你可以用.NET反射器和大量的空闲时间来做什么。:-)你太棒了!

票数 12
EN

Stack Overflow用户

发布于 2009-07-17 22:35:09

@Noldorin有一个很好的列表,列出了一些类型加速器。

PowerShell还允许您使用类型文字来转换对象、调用静态方法、访问静态属性、反射以及对System.Type对象的实例执行的任何其他操作。

为了使用类型文字,只需将类(或结构或枚举)的全名(或结构或枚举)(用句点分隔命名空间和类名)括在括号中,如下所示:

代码语言:javascript
复制
[System.Net.NetworkInformation.IPStatus]

PowerShell还将提供领先的“系统”。因此,如果您在System*名称空间中使用某些东西,则不需要显式地使用它。

代码语言:javascript
复制
[Net.NetworkInformation.IPStatus]

Oisin Grehan (a PowerShell MVP) also has a blog post about creating your own type accelerators

票数 3
EN

Stack Overflow用户

发布于 2016-04-12 03:20:14

下面是一个更完整的列表:

代码语言:javascript
复制
Key                   Value
---                   -----
adsi                  System.DirectoryServices.DirectoryEntry
adsisearcher          System.DirectoryServices.DirectorySearcher
array                 System.Array
bigint                System.Numerics.BigInteger
bool                  System.Boolean
byte                  System.Byte
char                  System.Char
cimclass              Microsoft.Management.Infrastructure.CimClass
cimconverter          Microsoft.Management.Infrastructure.CimConverter
ciminstance           Microsoft.Management.Infrastructure.CimInstance
cimtype               Microsoft.Management.Infrastructure.CimType
cultureinfo           System.Globalization.CultureInfo
datetime              System.DateTime
decimal               System.Decimal
double                System.Double
float                 System.Single
guid                  System.Guid
hashtable             System.Collections.Hashtable
initialsessionstate   System.Management.Automation.Runspaces.InitialSessionState
int                   System.Int32
int16                 System.Int16
int32                 System.Int32
int64                 System.Int64
ipaddress             System.Net.IPAddress
long                  System.Int64
mailaddress           System.Net.Mail.MailAddress
powershell            System.Management.Automation.PowerShell
psaliasproperty       System.Management.Automation.PSAliasProperty
pscredential          System.Management.Automation.PSCredential
pscustomobject        System.Management.Automation.PSObject
pslistmodifier        System.Management.Automation.PSListModifier
psmoduleinfo          System.Management.Automation.PSModuleInfo
psnoteproperty        System.Management.Automation.PSNoteProperty
psobject              System.Management.Automation.PSObject
psprimitivedictionary System.Management.Automation.PSPrimitiveDictionary
psscriptmethod        System.Management.Automation.PSScriptMethod
psscriptproperty      System.Management.Automation.PSScriptProperty
psvariable            System.Management.Automation.PSVariable
psvariableproperty    System.Management.Automation.PSVariableProperty
ref                   System.Management.Automation.PSReference
regex                 System.Text.RegularExpressions.Regex
runspace              System.Management.Automation.Runspaces.Runspace
runspacefactory       System.Management.Automation.Runspaces.RunspaceFactory
sbyte                 System.SByte
scriptblock           System.Management.Automation.ScriptBlock
securestring          System.Security.SecureString
single                System.Single
string                System.String
switch                System.Management.Automation.SwitchParameter
timespan              System.TimeSpan
type                  System.Type
uint16                System.UInt16
uint32                System.UInt32
uint64                System.UInt64
uri                   System.Uri
version               System.Version
void                  System.Void
wmi                   System.Management.ManagementObject
wmiclass              System.Management.ManagementClass
wmisearcher           System.Management.ManagementObjectSearcher
xml                   System.Xml.XmlDocument
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1145312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档