[int]::MaxValue

Welcome Forums General PowerShell Q&A [int]::MaxValue

Viewing 3 reply threads
  • Author
    Posts
    • #236782
      Participant
      Topics: 1
      Replies: 1
      Points: 13
      Rank: Member

      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

    • #236827
      Participant
      Topics: 11
      Replies: 31
      Points: 221
      Helping Hand
      Rank: Participant

      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…

    • #236830
      Participant
      Topics: 5
      Replies: 2384
      Points: 6,066
      Helping Hand
      Rank: Community MVP

      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
    • #236833
      Participant
      Topics: 1
      Replies: 1
      Points: 13
      Rank: Member

      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

Viewing 3 reply threads
  • You must be logged in to reply to this topic.