[int]::MaxValue

Hello,

I am using Invoke-SqlCmd and I don’t understand one things : "[int]:: "

What is the mining of the two “:” before declaration of type ? It’s used in the -MaxCharLength

Thank to you,

Yo

The :: is part of the calling sequence when you call native .NET classes or get static fields.

In this the .NET class is System.DateTime and the static field is Now.

Shamelessly copy/pasted from here, where there is also more information on how to use it…

You do not declare a variable type with this syntax you access the properties and methods. Try

[int]::MaxValue
… the output will be
2147483647
. And for
[int]::MinValue
it will be
-2147483648

Thank for your reply Olaf and Lars

Last one question about this, why need i to specify Type with [INT] before using this native classes ?

 

Have a nice day,

Yo