No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

PersonByNameComparer.cs

Description du code

PersonByNameComparer.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace be.gaudry.bibliobrol.model
  6. {
  7. class PersonByNameComparer : System.Collections.Generic.IComparer<Person>
  8. {
  9. #region IComparer Members
  10.  
  11. /*public int Compare(object x, object y)
  12.   {
  13.   try
  14.   {
  15.   Person p1 = (Person)x;
  16.   Person p2 = (Person)y;
  17.  
  18.   // pointers to a unique object -> no sort
  19.   if (p1 == p2) return 0;
  20.  
  21.   // compare lastNames
  22.   int testLastName = p1.getLastName().ToLower().CompareTo(p2.getLastName().ToLower());
  23.   if (testLastName == 0)
  24.   {
  25.   //compare firstNames
  26.   return p1.getFirstName().ToLower().CompareTo(p2.getFirstName().ToLower());
  27.   }
  28.   else return testLastName;
  29.  
  30.   }
  31.   catch (Exception e)
  32.   {
  33.   // At least one object is not a Person -> no sort
  34.   return 0;
  35.   }
  36.   }*/
  37.  
  38. #endregion
  39.  
  40. #region IComparer<Person> Members
  41.  
  42. public int Compare(Person x, Person y)
  43. {
  44. Person p1 = (Person)x;
  45. Person p2 = (Person)y;
  46.  
  47. // pointers to a unique object -> no sort
  48. if (p1 == p2) return 0;
  49.  
  50. // compare lastNames
  51. int testLastName = p1.LastName.ToLower().CompareTo(p2.LastName.ToLower());
  52. if (testLastName == 0)
  53. {
  54. //compare firstNames
  55. return p1.FirstName.ToLower().CompareTo(p2.FirstName.ToLower());
  56. }
  57. else return testLastName;
  58. }
  59.  
  60. #endregion
  61. }
  62. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/model/comparators/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1716086222 19/05/2024 04:37:02
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/model/comparators/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csPersonByNameComparer.cs1.77 Ko31/10/2018 18:32:54-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-bibliobrol-source-rf-model/comparators/PersonByNameComparer.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.