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. list<t> to array</t>

list<t> to array</t>

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

    How to sort array values. but sot\rting parameters are in list.what do do? for example in below code i want sort the values. what shall i do? shall you help me for this sorting process? private struct Xsweep { public double X; public double Y; public int cI; public int pI; public int nI; public int n; } List Poly = new List(); List X = new List(); n = Poly.Count - 1; for (int i = 0; i <= n; i++) { if(i < X.Count) X[i] = Poly[i].X; else X.Add(Poly[i].X); } Array.Sort(X, Poly);

    C N H S 4 Replies Last reply
    0
    • C cst_kvp

      How to sort array values. but sot\rting parameters are in list.what do do? for example in below code i want sort the values. what shall i do? shall you help me for this sorting process? private struct Xsweep { public double X; public double Y; public int cI; public int pI; public int nI; public int n; } List Poly = new List(); List X = new List(); n = Poly.Count - 1; for (int i = 0; i <= n; i++) { if(i < X.Count) X[i] = Poly[i].X; else X.Add(Poly[i].X); } Array.Sort(X, Poly);

      C Offline
      C Offline
      cst_kvp
      wrote on last edited by
      #2

      some codes are changed there Poly is list[XSweep] X is list[double]

      1 Reply Last reply
      0
      • C cst_kvp

        How to sort array values. but sot\rting parameters are in list.what do do? for example in below code i want sort the values. what shall i do? shall you help me for this sorting process? private struct Xsweep { public double X; public double Y; public int cI; public int pI; public int nI; public int n; } List Poly = new List(); List X = new List(); n = Poly.Count - 1; for (int i = 0; i <= n; i++) { if(i < X.Count) X[i] = Poly[i].X; else X.Add(Poly[i].X); } Array.Sort(X, Poly);

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        cst_kvp wrote:

        List Poly = new List(); List X = new List(); n = Poly.Count - 1;

        :confused: What is this ? You have not added anything to your list poly, how can you iterate the items then ?

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        1 Reply Last reply
        0
        • C cst_kvp

          How to sort array values. but sot\rting parameters are in list.what do do? for example in below code i want sort the values. what shall i do? shall you help me for this sorting process? private struct Xsweep { public double X; public double Y; public int cI; public int pI; public int nI; public int n; } List Poly = new List(); List X = new List(); n = Poly.Count - 1; for (int i = 0; i <= n; i++) { if(i < X.Count) X[i] = Poly[i].X; else X.Add(Poly[i].X); } Array.Sort(X, Poly);

          H Offline
          H Offline
          Henrik K Larsen
          wrote on last edited by
          #4

          Hi, Did you look at the built in sortable list types ?


          Those who want most to speak up, are often those who have nothing clever to say.

          1 Reply Last reply
          0
          • C cst_kvp

            How to sort array values. but sot\rting parameters are in list.what do do? for example in below code i want sort the values. what shall i do? shall you help me for this sorting process? private struct Xsweep { public double X; public double Y; public int cI; public int pI; public int nI; public int n; } List Poly = new List(); List X = new List(); n = Poly.Count - 1; for (int i = 0; i <= n; i++) { if(i < X.Count) X[i] = Poly[i].X; else X.Add(Poly[i].X); } Array.Sort(X, Poly);

            S Offline
            S Offline
            Sathesh Sakthivel
            wrote on last edited by
            #5

            there is no logic at all in ur code. First read some books related to arrays and then try to code it.

            SSK. Anyone who says sunshine brings happiness has never danced in the rain.

            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