String v. string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    String v. string

    Could someone explain why there is a Datatype (Class) called String, and a
    static class string that has methods of it's own? Is String the instance
    class and string is the static class??

    Thanks in advance.

    Mark


  • Frank Oquendo

    #2
    Re: String v. string

    Mark wrote:[color=blue]
    > Could someone explain why there is a Datatype (Class) called String,
    > and a static class string that has methods of it's own? Is String
    > the instance class and string is the static class??[/color]

    string is a C# wrapper for the CLR's System.String class. As for
    instance vs. static, a class is neither. string can be instantiated
    *and* it has static methods.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.


    (Pull the pin to reply)


    Comment

    • Jay B. Harlow [MVP - Outlook]

      #3
      Re: String v. string

      Mark,
      "String" is the name of the System.String class.

      While "string" is C#'s alias for the System.String class. Which means they
      are both refer to exactly the same class.

      In other words:

      Debug.Assert(ty peof(string) == typeof(System.S tring), "must be true!");

      Hope this helps
      Jay

      "Mark" <mfield@idonotl ikespam.cce.umn .edu> wrote in message
      news:uO4qYpgrDH A.2892@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Could someone explain why there is a Datatype (Class) called String, and a
      > static class string that has methods of it's own? Is String the instance
      > class and string is the static class??
      >
      > Thanks in advance.
      >
      > Mark
      >
      >[/color]


      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: String v. string

        Avlin,

        You are correct, "string" in C# is just an alias for System.String.
        What one sees as static on "string" can also be accessed through
        "System.Str ing" in the same manner (same methods, etc, etc).

        Hope this helps.

        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "Alvin" <alvinbj@hotmai l.com> wrote in message
        news:OfrcyxgrDH A.2440@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Isnt the string keyword just an ALIAS for System.String like and not
        > actually a wrapper?
        >
        > "Frank Oquendo" <franko@acadxpi n.com> wrote in message
        > news:u5zJzrgrDH A.2488@TK2MSFTN GP12.phx.gbl...[color=green]
        > > Mark wrote:[color=darkred]
        > > > Could someone explain why there is a Datatype (Class) called String,
        > > > and a static class string that has methods of it's own? Is String
        > > > the instance class and string is the static class??[/color]
        > >
        > > string is a C# wrapper for the CLR's System.String class. As for
        > > instance vs. static, a class is neither. string can be instantiated
        > > *and* it has static methods.
        > >
        > > --
        > > There are 10 kinds of people. Those who understand binary and those who
        > > don't.
        > >
        > > http://code.acadx.com
        > > (Pull the pin to reply)
        > >
        > >[/color]
        >
        >
        >[/color]


        Comment

        • Michael Culley

          #5
          Re: String v. string

          "Alvin" <alvinbj@hotmai l.com> wrote in message news:OfrcyxgrDH A.2440@TK2MSFTN GP10.phx.gbl...

          Can you stop posting that picture, we have limited usage here and everything is logged, I think everyone has seen it by now.

          --
          Michael Culley


          Comment

          Working...