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. Undefined String Array..

Undefined String Array..

Scheduled Pinned Locked Moved C#
data-structureshelpquestion
7 Posts 5 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.
  • P Offline
    P Offline
    ptr2void
    wrote on last edited by
    #1

    Hi can anyone write a one line if() condition to find out whether a string array has undefined values?? I am checking like this: if(arr == nullptr) but this does not help..

    Som

    A D M 4 Replies Last reply
    0
    • P ptr2void

      Hi can anyone write a one line if() condition to find out whether a string array has undefined values?? I am checking like this: if(arr == nullptr) but this does not help..

      Som

      A Offline
      A Offline
      AhsanS
      wrote on last edited by
      #2

      if(arr == null)

      Ahsan Ullah Senior Software Engineer

      D 1 Reply Last reply
      0
      • A AhsanS

        if(arr == null)

        Ahsan Ullah Senior Software Engineer

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

        This checks if array itself is null. I think the OP want to know if array contains at least one item that is null.


        [My Blog]
        "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
        "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

        1 Reply Last reply
        0
        • P ptr2void

          Hi can anyone write a one line if() condition to find out whether a string array has undefined values?? I am checking like this: if(arr == nullptr) but this does not help..

          Som

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

          What about if(Array.IndexOf(arr,null)>-1)?


          [My Blog]
          "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
          "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

          M 1 Reply Last reply
          0
          • P ptr2void

            Hi can anyone write a one line if() condition to find out whether a string array has undefined values?? I am checking like this: if(arr == nullptr) but this does not help..

            Som

            A Offline
            A Offline
            AhsanS
            wrote on last edited by
            #5

            foreach(string s in arr) { if(s==null) { return true; } }

            Ahsan Ullah Senior Software Engineer

            1 Reply Last reply
            0
            • D DavidNohejl

              What about if(Array.IndexOf(arr,null)>-1)?


              [My Blog]
              "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn
              "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

              M Offline
              M Offline
              Martin 0
              wrote on last edited by
              #6

              His teacher will be impressed! ;)

              All the best, Martin

              1 Reply Last reply
              0
              • P ptr2void

                Hi can anyone write a one line if() condition to find out whether a string array has undefined values?? I am checking like this: if(arr == nullptr) but this does not help..

                Som

                M Offline
                M Offline
                MuhammadFaisal
                wrote on last edited by
                #7

                assign null on the definition of your array and then you can check if(arr==null) otherwise compilor will gave error

                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