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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. returning arrray from a function

returning arrray from a function

Scheduled Pinned Locked Moved C#
data-structurestutorialquestion
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.
  • S Offline
    S Offline
    saqib82
    wrote on last edited by
    #1

    Hi Can someone tell me how to return an array from a function??? Regards

    sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

    C D S H 4 Replies Last reply
    0
    • S saqib82

      Hi Can someone tell me how to return an array from a function??? Regards

      sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

      C Offline
      C Offline
      Christopher Stratmann
      wrote on last edited by
      #2

      object[] MyFunction() { }

      1 Reply Last reply
      0
      • S saqib82

        Hi Can someone tell me how to return an array from a function??? Regards

        sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

        D Offline
        D Offline
        Dave Herren
        wrote on last edited by
        #3

        public string[] myfunction() { string[] myarray = {"test","test","Test"}; return myarray; }

        topcoderjax - Remember, Google is your friend.

        1 Reply Last reply
        0
        • S saqib82

          Hi Can someone tell me how to return an array from a function??? Regards

          sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

          S Offline
          S Offline
          Sandeep Akhare
          wrote on last edited by
          #4

          saqib82 wrote:

          tell me how to return an array from a function???

          But What is the type of the array string[] function() int[] function() IF you don't what will the type then check for Generic new in Dot net Framework

          Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          D 1 Reply Last reply
          0
          • S Sandeep Akhare

            saqib82 wrote:

            tell me how to return an array from a function???

            But What is the type of the array string[] function() int[] function() IF you don't what will the type then check for Generic new in Dot net Framework

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            D Offline
            D Offline
            Dave Herren
            wrote on last edited by
            #5

            Haven't handled arrays in generics, but here is an article[^] An excerpt shows this: 23 // output array of all types 24 static void PrintArray< E >( E[] inputArray ) 25 { 26 foreach ( E element in inputArray ) 27 Console.Write( element + " " ); 28 29 Console.WriteLine( "\n" ); 30 }

            topcoderjax - Remember, Google is your friend.

            S 1 Reply Last reply
            0
            • D Dave Herren

              Haven't handled arrays in generics, but here is an article[^] An excerpt shows this: 23 // output array of all types 24 static void PrintArray< E >( E[] inputArray ) 25 { 26 foreach ( E element in inputArray ) 27 Console.Write( element + " " ); 28 29 Console.WriteLine( "\n" ); 30 }

              topcoderjax - Remember, Google is your friend.

              S Offline
              S Offline
              Sandeep Akhare
              wrote on last edited by
              #6

              Yes but i think the function you have written is similar to genric

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

              1 Reply Last reply
              0
              • S saqib82

                Hi Can someone tell me how to return an array from a function??? Regards

                sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                And see here[^]


                WhiteSky


                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