国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > PowerShell > 正文

Powershell中可以使用的.Net實(shí)用靜態(tài)方法

2020-03-26 19:10:50
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

支持所有版本。

Powershell能夠使用.net靜態(tài)方法,比如下面有一些你常用的方法:

復(fù)制代碼 代碼如下:

[Math]::Round(7.9)
 
[Convert]::ToString(576255753217, 8)
 
[Guid]::NewGuid()
 
[Net.Dns]::GetHostByName('schulung12')
 
[IO.Path]::GetExtension('c:/test.txt')
 
[IO.Path]::ChangeExtension('c:/test.txt', 'bak')

 

要獲得更多的方法,你可以刪掉方括號(hào)后面的代碼,再添加兩個(gè)冒號(hào),這時(shí)在Powershell_ISE中將會(huì)彈出這個(gè)類所有可選的方法及屬性。在Powershell控制臺(tái)中,你也可以使用TAB來(lái)獲取選擇方法屬性。

當(dāng)然你也可以通過(guò)管道符查看他所有類型:

復(fù)制代碼 代碼如下:

PS> [Math] | Get-Member -MemberType *Method -Static

 


   TypeName: System.Math

Name            MemberType Definition                                                                                    
----            ---------- ----------                                                                                    
Abs             Method     static sbyte Abs(sbyte value), static int16 Abs(int16 value), static int Abs(int value), sta...
Acos            Method     static double Acos(double d)          
Asin            Method     static double Asin(double d)           
Atan            Method     static double Atan(double d)           
Atan2           Method     static double Atan2(double y, double x)
BigMul          Method     static long BigMul(int a, int b)  
Ceiling         Method     static decimal Ceiling(decimal d), static double Ceiling(double a)
Cos             Method     static double Cos(double d)
Cosh            Method     static double Cosh(double value                                                            
DivRem          Method     static int DivRem(int a, int b, [ref] int result), static long DivRem(long a, long b, [ref] ...
Equals          Method     static bool Equals(System.Object objA, System.Object objB)
Exp             Method     static double Exp(double d)             
Floor           Method     static decimal Floor(decimal d), static double Floor(double d)
IEEERemainder   Method     static double IEEERemainder(double x, double y)
Log             Method     static double Log(double d), static double Log(double a, double newBase)
Log10           Method     static double Log10(double d)
Max             Method     static sbyte Max(sbyte val1, sbyte val2), static byte Max(byte val1, byte val2), static int1...
Min             Method     static sbyte Min(sbyte val1, sbyte val2), static byte Min(byte val1, byte val2), static int1...
Pow             Method     static double Pow(double x, double y)
ReferenceEquals Method     static bool ReferenceEquals(System.Object objA, System.Object objB)
Round           Method     static double Round(double a), static double Round(double value, int digits), static double ...
Sign            Method     static int Sign(sbyte value), static int Sign(int16 value), static int Sign(int value), stat...
Sin             Method     static double Sin(double a)
Sinh            Method     static double Sinh(double value)  
Sqrt            Method     static double Sqrt(double d)
Tan             Method     static double Tan(double a)
Tanh            Method     static double Tanh(double value)
Truncate        Method     static decimal Truncate(decimal d), static double Truncate(double d)

 

要查看方法的參數(shù),省略掉他的括號(hào)即可:

 

復(fù)制代碼 代碼如下:

PS> Get-Something -Path test
You entered test.

 

PS> [Math]::Round

OverloadDefinitions                                                                                                      
-------------------                                                                                                      
static double Round(double a
static double Round(double value, int digits)
static double Round(double value, System.MidpointRounding mode)
static double Round(double value, int digits, System.MidpointRounding mode
static decimal Round(decimal d
static decimal Round(decimal d, int decimals)
static decimal Round(decimal d, System.MidpointRounding mode)
static decimal Round(decimal d, int decimals, System.MidpointRounding mode)


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 项城市| 铁力市| 渑池县| 康平县| 正宁县| 洛扎县| 临朐县| 平乡县| 黄冈市| 黄大仙区| 定西市| SHOW| 台山市| 阿拉善右旗| 建瓯市| 曲沃县| 海盐县| 顺平县| 新郑市| 台北县| 内黄县| 丰宁| 定安县| 平顺县| 庆云县| 都兰县| 丰台区| 合江县| 如东县| 开原市| 浦江县| 洛宁县| 宁波市| 江源县| 泸州市| 慈溪市| 长丰县| 翁源县| 龙里县| 富源县| 韩城市|