0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PowerShellで.NET FrameworkのConvert.ToDoubleを呼び出す

Posted at

PowershellでC#のConvert.ToDoubleなどを呼び出す

以下の記法、ただし、ToDoubleに空白文字を入れると例外を出す。
$nullの場合には0を返す。

C:\> [System.Convert]::ToDouble("100")
100
C:\> [System.Convert]::ToDouble($null)
0
C:\> [System.Convert]::ToDouble("")
"1" 個の引数を指定して "ToDouble" を呼び出し中に例外が発生しました: "入力文字列の形式が正しくありません。"
発生場所 行:1 文字:1
+ [System.Convert]::ToDouble("")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?