Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Difference between String and string?

Difference between String and string?

Scheduled Pinned Locked Moved C#
question
13 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M A Burhan
    wrote on last edited by
    #1

    Hi Groups What is the Difference between String and string? When will we use String? Bye

    A B V E X 6 Replies Last reply
    0
    • M M A Burhan

      Hi Groups What is the Difference between String and string? When will we use String? Bye

      B Offline
      B Offline
      Blumen
      wrote on last edited by
      #2

      "string" is a data type. "String" is a Class in C#

      D 1 Reply Last reply
      0
      • M M A Burhan

        Hi Groups What is the Difference between String and string? When will we use String? Bye

        A Offline
        A Offline
        Arun Immanuel
        wrote on last edited by
        #3

        "String" is the class and "string" is the alias name of the String class. I think I am right.

        Regards, Arun Kumar.A

        1 Reply Last reply
        0
        • M M A Burhan

          Hi Groups What is the Difference between String and string? When will we use String? Bye

          V Offline
          V Offline
          Vikram A Punathambekar
          wrote on last edited by
          #4

          They're the same.

          Cheers, Vıkram.


          Déjà moo - The feeling that you've seen this bull before. Join the CP group at NationStates. Password: byalmightybob

          B 1 Reply Last reply
          0
          • V Vikram A Punathambekar

            They're the same.

            Cheers, Vıkram.


            Déjà moo - The feeling that you've seen this bull before. Join the CP group at NationStates. Password: byalmightybob

            B Offline
            B Offline
            Blumen
            wrote on last edited by
            #5

            How can a Class and datatype be the same?

            C 1 Reply Last reply
            0
            • M M A Burhan

              Hi Groups What is the Difference between String and string? When will we use String? Bye

              E Offline
              E Offline
              Elina Blank
              wrote on last edited by
              #6

              String is class. string is a keyword (which is under the hood is translated to .NET class System.String)

              Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O

              1 Reply Last reply
              0
              • B Blumen

                How can a Class and datatype be the same?

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                All classes are types. string is a synonym for System.String nothing more, nothing less.


                Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

                1 Reply Last reply
                0
                • M M A Burhan

                  Hi Groups What is the Difference between String and string? When will we use String? Bye

                  X Offline
                  X Offline
                  xibeifeijian
                  wrote on last edited by
                  #8

                  No difference! string is a keyword,but String not. string just like a shortcut for String.

                  :^):^):^):^):^):^):^):^):^):^):^):^) :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::^):^):^):^)▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):^):^):^):^):^):^):^):^):^):^):^)

                  1 Reply Last reply
                  0
                  • M M A Burhan

                    Hi Groups What is the Difference between String and string? When will we use String? Bye

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    The keyword string is an alias for System.String. I only know of two differences between using an alias keyword and the specific class name: :: You have to have using System; to use String, otherwise you have to specify the full name System.String. :: For some special uses of data types only the keyword works. You can for example specify that an enum should use int as internal storage type, but you can't specify System.Int32 instead.

                    --- single minded; short sighted; long gone;

                    B 1 Reply Last reply
                    0
                    • B Blumen

                      "string" is a data type. "String" is a Class in C#

                      D Offline
                      D Offline
                      DavidNohejl
                      wrote on last edited by
                      #10

                      blumenhause wrote:

                      "String" is a Class in C#

                      Well, you are right in that System.String is class. But how you say it is... um... System.String is CLI built-in type/class. string is C# specific alias of System.String I didn't vote but someone probably found your answer confusing. :)


                      "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

                      B 1 Reply Last reply
                      0
                      • G Guffa

                        The keyword string is an alias for System.String. I only know of two differences between using an alias keyword and the specific class name: :: You have to have using System; to use String, otherwise you have to specify the full name System.String. :: For some special uses of data types only the keyword works. You can for example specify that an enum should use int as internal storage type, but you can't specify System.Int32 instead.

                        --- single minded; short sighted; long gone;

                        B Offline
                        B Offline
                        Blumen
                        wrote on last edited by
                        #11

                        thanks alot for the clarification.

                        L 1 Reply Last reply
                        0
                        • D DavidNohejl

                          blumenhause wrote:

                          "String" is a Class in C#

                          Well, you are right in that System.String is class. But how you say it is... um... System.String is CLI built-in type/class. string is C# specific alias of System.String I didn't vote but someone probably found your answer confusing. :)


                          "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

                          B Offline
                          B Offline
                          Blumen
                          wrote on last edited by
                          #12

                          sorry if that was confusing.. but i think many of our members opinion clarifies this confusion.

                          1 Reply Last reply
                          0
                          • B Blumen

                            thanks alot for the clarification.

                            L Offline
                            L Offline
                            Leyu
                            wrote on last edited by
                            #13

                            String is .NET CTS type where as string is built in C# datatype which virtually means String just like Int32 struct and int, Bottom line both are the same

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups