A. Net practical static method that can be used in PowerShell _powershell

Source: Internet
Author: User
Tags abs acos asin cos pow sin

All versions are supported.

PowerShell can use. NET static methods, such as the following some of your common methods:

Copy Code code as follows:

[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 ')

To get more methods, you can delete the code behind the brackets and add two colons, which will pop up all of the optional methods and properties in Powershell_ise. In the PowerShell console, you can also use tab to get the selection method properties.

Of course, you can also view all of his types through a pipe character:

Copy Code code as follows:

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)

To see the parameters of a method, omit his parentheses:

Copy Code code as follows:

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)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.