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. Other Discussions
  3. The Weird and The Wonderful
  4. Sort by the first 3 characters

Sort by the first 3 characters

Scheduled Pinned Locked Moved The Weird and The Wonderful
8 Posts 5 Posters 12 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.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    Complete class provided for entertainment purposes ;P

    namespace BusinessEntities
    {
    public class DropDownLists
    {
    private Collection<ListItem> myList;

    public static DropDownLists Construct\_DropDownLists()
    {
      DropDownLists tmpDropDownLists \= new DropDownLists();
    
      return tmpDropDownLists;
    }
    
    public Collection<ListItem\> MyList
    {
      get
      {
        if (myList \== null)
        {
          myList \= new Collection<ListItem\>();
        }
        return myList;
      }
      set { myList \= value; }
    }
    
    /// <
    
    Z P P 3 Replies Last reply
    0
    • L leppie

      Complete class provided for entertainment purposes ;P

      namespace BusinessEntities
      {
      public class DropDownLists
      {
      private Collection<ListItem> myList;

      public static DropDownLists Construct\_DropDownLists()
      {
        DropDownLists tmpDropDownLists \= new DropDownLists();
      
        return tmpDropDownLists;
      }
      
      public Collection<ListItem\> MyList
      {
        get
        {
          if (myList \== null)
          {
            myList \= new Collection<ListItem\>();
          }
          return myList;
        }
        set { myList \= value; }
      }
      
      /// <
      
      Z Offline
      Z Offline
      Zani Jnior
      wrote on last edited by
      #2

      Congratulations to these "self-studies".

      -+--+--+--+--+--+--+-+-+-+ Carlos Zani - SP - Brazil Powered by Microsof.Net

      1 Reply Last reply
      0
      • L leppie

        Complete class provided for entertainment purposes ;P

        namespace BusinessEntities
        {
        public class DropDownLists
        {
        private Collection<ListItem> myList;

        public static DropDownLists Construct\_DropDownLists()
        {
          DropDownLists tmpDropDownLists \= new DropDownLists();
        
          return tmpDropDownLists;
        }
        
        public Collection<ListItem\> MyList
        {
          get
          {
            if (myList \== null)
            {
              myList \= new Collection<ListItem\>();
            }
            return myList;
          }
          set { myList \= value; }
        }
        
        /// <
        
        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        But which part do you particularly wish to point out? I find the use of string.ToString() the most humorous. I'm also not sure what you mean by the title; Array.Sort(myKeys, myValues, 1, 3); won't "Sort by the first 3 characters", it sorts the second through fourth items.

        modified on Sunday, June 8, 2008 11:14 AM

        L K 3 Replies Last reply
        0
        • P PIEBALDconsult

          But which part do you particularly wish to point out? I find the use of string.ToString() the most humorous. I'm also not sure what you mean by the title; Array.Sort(myKeys, myValues, 1, 3); won't "Sort by the first 3 characters", it sorts the second through fourth items.

          modified on Sunday, June 8, 2008 11:14 AM

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          PIEBALDconsult wrote:

          I'm also not sure what you mean by the title; Array.Sort(myKeys, myValues, 1, 3); won't "Sort by the first 3 characters", it sorts the second through fourth items.

          Exactly ;P Thats the real horror, how he gets there is a horror too! All this has been reduced to 2 lines of code getting data straight from the DB.

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          1 Reply Last reply
          0
          • P PIEBALDconsult

            But which part do you particularly wish to point out? I find the use of string.ToString() the most humorous. I'm also not sure what you mean by the title; Array.Sort(myKeys, myValues, 1, 3); won't "Sort by the first 3 characters", it sorts the second through fourth items.

            modified on Sunday, June 8, 2008 11:14 AM

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            :omg: I see now where it comes from! MSDN copy and paste code (and steal the comment while you at it)!! :sigh: http://msdn.microsoft.com/en-us/library/73z19xf7.aspx[^]

            xacc.ide - now with TabsToSpaces support
            IronScheme - 1.0 alpha 4a out now (29 May 2008)

            1 Reply Last reply
            0
            • L leppie

              Complete class provided for entertainment purposes ;P

              namespace BusinessEntities
              {
              public class DropDownLists
              {
              private Collection<ListItem> myList;

              public static DropDownLists Construct\_DropDownLists()
              {
                DropDownLists tmpDropDownLists \= new DropDownLists();
              
                return tmpDropDownLists;
              }
              
              public Collection<ListItem\> MyList
              {
                get
                {
                  if (myList \== null)
                  {
                    myList \= new Collection<ListItem\>();
                  }
                  return myList;
                }
                set { myList \= value; }
              }
              
              /// <
              
              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              leppie wrote:

              /// /// This method can be customized to return a list of data from any source, e.g database, xml file, object, etc. /// /// Object instance of DropDownLists class. /// ItemCollection public Collection GetTitles(DropDownLists tmpDropDownLists) { //Currently the data is hardcoded, but can also be queried from a database. tmpDropDownLists.myList = new Collection(); ListItem li = new ListItem(); li.Value = "1"; li.Text = "Mr."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "2"; li.Text = "Mrs."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "3"; li.Text = "Me."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "4"; li.Text = "Dr."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "5"; li.Text = "Prof."; tmpDropDownLists.myList.Add(li);

              Oh, if only there existed some technology where you could add items from some source of data. That would be sure to catch on. :rolleyes:

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              P 1 Reply Last reply
              0
              • P Pete OHanlon

                leppie wrote:

                /// /// This method can be customized to return a list of data from any source, e.g database, xml file, object, etc. /// /// Object instance of DropDownLists class. /// ItemCollection public Collection GetTitles(DropDownLists tmpDropDownLists) { //Currently the data is hardcoded, but can also be queried from a database. tmpDropDownLists.myList = new Collection(); ListItem li = new ListItem(); li.Value = "1"; li.Text = "Mr."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "2"; li.Text = "Mrs."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "3"; li.Text = "Me."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "4"; li.Text = "Dr."; tmpDropDownLists.myList.Add(li); li = new ListItem(); li.Value = "5"; li.Text = "Prof."; tmpDropDownLists.myList.Add(li);

                Oh, if only there existed some technology where you could add items from some source of data. That would be sure to catch on. :rolleyes:

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Only if you publish documentation... perhaps on a website.

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  But which part do you particularly wish to point out? I find the use of string.ToString() the most humorous. I'm also not sure what you mean by the title; Array.Sort(myKeys, myValues, 1, 3); won't "Sort by the first 3 characters", it sorts the second through fourth items.

                  modified on Sunday, June 8, 2008 11:14 AM

                  K Offline
                  K Offline
                  KarstenK
                  wrote on last edited by
                  #8

                  This enhances readability. :-O

                  Greetings from Germany

                  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