dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/runtime/System Enum.cs,1.15,1.16


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/runtime/System Enum.cs,1.15,1.16
Date: Tue, 30 Sep 2003 02:48:41 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv7925/runtime/System

Modified Files:
        Enum.cs 
Log Message:


Sort the return values from "Enum.GetValues" and "Enum.GetNames".


Index: Enum.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Enum.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Enum.cs     20 Aug 2003 03:47:50 -0000      1.15
--- Enum.cs     30 Sep 2003 02:48:39 -0000      1.16
***************
*** 233,238 ****
                                }
  
!                               // Create and fill the name array.
                                String[] names = new String [numLiterals];
                                numLiterals = 0;
                                for(posn = 0; posn < fields.Length; ++posn)
--- 233,239 ----
                                }
  
!                               // Create and fill the name and value arrays.
                                String[] names = new String [numLiterals];
+                               Array values = Array.CreateInstance(enumType, 
numLiterals);
                                numLiterals = 0;
                                for(posn = 0; posn < fields.Length; ++posn)
***************
*** 240,246 ****
                                        if(fields[posn] != null)
                                        {
!                                               names[numLiterals++] = 
fields[posn].Name;
                                        }
                                }
                                return names;
                        }
--- 241,253 ----
                                        if(fields[posn] != null)
                                        {
!                                               names[numLiterals] = 
fields[posn].Name;
!                                               
values.SetValue(fields[posn].GetValue(null),
!                                                                               
numLiterals);
!                                               ++numLiterals;
                                        }
                                }
+ 
+                               // Sort the arrays on value, and then return 
the names only.
+                               Array.Sort(values, names);
                                return names;
                        }
***************
*** 329,332 ****
--- 336,342 ----
                                        }
                                }
+ 
+                               // Sort the array on value and return it.
+                               Array.Sort(values);
                                return values;
                        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]