begin process at 2012 02 11 15:30:17
  Trouver un code source :
 
dans
 

5 commentaire(s) de spikeyz sur des sources sur tout CodeS-SourceS

Déposé sur Extender gridview pour traitements lourds de listes

Nikel, Merci
Posté le : 21/11/2008 10:41:50

Déposé sur Extender gridview pour traitements lourds de listes

Bonjour,
Peux-tu mettre la page default.aspx avec l'action sur le bouton de control car je n'arrive pas a utiliser l'extender.

Merci d'avance et bonne continuation.
Posté le : 20/11/2008 16:45:59

Déposé sur Gestion des articles d'un super marché

C'est normal si tu essaye de faire un ToString() sur une collection.
Par contre tu verra que tous les elements de ta liste sont présents dans la List<String>.
A toi de la parcourir comme tout autre collec.
@++
Posté le : 17/02/2007 17:44:45

Déposé sur Gestion des articles d'un super marché

Salut,
moi je pense que tu devrais essayer avec ca :


        /// <summary>
        /// Methode qui split le text (vendre 5 L lait 6 Kg mangue 2 Kg banane)
        /// </summary>
        /// <param name="str">(vendre 5 L lait 6 Kg mangue 2 Kg banane)</param>
        /// <returns>List(str)</returns>
        public List<String> SplitSpecial(String str)
        {
            if (str.StartsWith("vendre "))
                str = str.Remove(0, 7);

            List<String> lst = new List<String>();

            StringBuilder strB = new StringBuilder();

            Char[] strToChar = str.ToCharArray();

            int i, j;

            for (i = 0, j = 1; i < strToChar.Length; i++, j++)
            {
                if (Char.IsDigit(strToChar[i]) && !Char.IsDigit(strToChar[j]))
                {
                    if (strB.ToString().Length != 0)
                        lst.Add(strB.ToString());

                    strB = new StringBuilder();
                    strB.Append(strToChar[i]);
                }
                else
                {
                    strB.Append(strToChar[i]);
                }
            }

            lst.Add(strB.ToString());

            return lst;
        }
Posté le : 16/02/2007 01:30:44

Déposé sur Methode clonage 'deepclonage'

Voila moi je viens de finir une methode un peu plus complete que celle-ci si ca interresse quelqu'un.

public object Clone()
        {
            //Creation de la nouvelle instance de l'objet
            Object newObject = Activator.CreateInstance(this.GetType());

            //Recuperation de toutes les proprietes de l'objet
            PropertyInfo[] infos = newObject.GetType().GetProperties();

            foreach (PropertyInfo info in infos)
            {
                //Test de la propriete pour savoir si elle supporte l'interface ICloneable
                Type ICloneType = info.PropertyType.GetInterface("ICloneable", true);

                if (ICloneType != null)
                {
                    //Recuperation de l'interface ICloneable de l'objet
                    ICloneable IClone = (ICloneable)info.GetValue(this, null);

                    //utilisation de la methode clone() pour assigner la nouvelle valeur de la propriete
                    info.SetValue(newObject, IClone.Clone(), null);
                }
                else
                    //Si la propriete ne supporte pas l'interface, assignation juste de la valeur
                    info.SetValue(newObject, info.GetValue(this, null), null);

                //Test de la propriete pour savoir si elle supporte l'interface IEnumerable
                Type IEnumerabletype = info.PropertyType.GetInterface("IEnumerable", true);

                if (IEnumerabletype != null)
                {
                    //Recuperation de l'interface IEnumerable de la propriete
                    IEnumerable IEnum = (IEnumerable)info.GetValue(this, null);

                    Type IListType = info.PropertyType.GetInterface("IList", true);
                    Type IDicType = info.PropertyType.GetInterface("IDictionary", true);

                    int j = 0;

                    if (IListType != null)
                    {
                        //recuperation de l'interface IList
                        IList list = (IList)info.GetValue(newObject,null);

                        foreach (Object obj in IEnum)
                        {
                            //Test de l'objet pour savoir si il supporte l'interface ICloneable
                            ICloneType = obj.GetType().GetInterface("ICloneable", true);

                            if (ICloneType != null)
                            {
                                ICloneable clone = (ICloneable)obj;
                                list[j] = clone.Clone();
                            }
                            j++;
                        }
                    }
                    else if (IDicType != null)
                    {
                        //Recuperation de l'interface IDictionary
                        IDictionary dic = (IDictionary)info.GetValue(newObject,null);

                        j = 0;

                        foreach (DictionaryEntry de in IEnum)
                        {
                            //Test de l'objet pour savoir si il supporte l'interface ICloneable
                            ICloneType = de.Value.GetType().GetInterface("ICloneable", true);

                            if (ICloneType != null)
                            {
                                ICloneable clone = (ICloneable)de.Value;
                                dic[de.Key] = clone.Clone();
                            }
                            j++;
                        }
                    }
                }
            }

            //Recuperation de tous les champs de cette instance
            FieldInfo[] fields = newObject.GetType().GetFields();

            foreach (FieldInfo fi in this.GetType().GetFields())
            {
                //Test du champs pour savoir si il supporte l'interface ICloneable
                Type ICloneType = fi.FieldType.GetInterface("ICloneable", true);

                if (ICloneType != null)
                {
                    //Recuperation de l'interface ICloneable de l'objet
                    ICloneable IClone = (ICloneable)fi.GetValue(this);

                    //utilisation de la methode clone() pour assigner la nouvelle valeur du champs
                    fi.SetValue(newObject, IClone.Clone());
                }
                else
                {
                    //Si le champs ne supporte pas l'interface, assignation juste du champs
                    fi.SetValue(newObject, fi.GetValue(this));
                }

                //Test du champs pour savoir si il support l'interface IEnumerable
                Type IEnumerabletype = fi.FieldType.GetInterface("IEnumerable", true);

                if (IEnumerabletype != null)
                {
                    //Recuperation de l'interface IEnumerable du champs
                    IEnumerable IEnum = (IEnumerable)fi.GetValue(this);

                    Type IListType = fi.FieldType.GetInterface("IList", true);
                    Type IDicType = fi.FieldType.GetInterface("IDictionary", true);

                    int j = 0;

                    if (IListType != null)
                    {
                        //recuperation de l'interface IList
                        IList list = (IList)fi.GetValue(newObject);

                        foreach (Object obj in IEnum)
                        {
                            //Test de l'objet pour savoir si il supporte l'interface ICloneable
                            ICloneType = obj.GetType().GetInterface("ICloneable", true);

                            if (ICloneType != null)
                            {
                                ICloneable clone = (ICloneable)obj;
                                list[j] = clone.Clone();
                            }
                            j++;
                        }
                    }
                    else if(IDicType != null)
                    {
                        //Recuperation de l'interface IDictionary
                        IDictionary dic = (IDictionary)fi.GetValue(newObject);

                        j = 0;

                        foreach (DictionaryEntry de in IEnum)
                        {
                            //Test de l'objet pour savoir si il supporte l'interface ICloneable
                            ICloneType = de.Value.GetType().GetInterface("ICloneable", true);

                            if (ICloneType != null)
                            {
                                ICloneable clone = (ICloneable)de.Value;
                                dic[de.Key] = clone.Clone();
                            }
                        j++;
                        }
                    }
                }
            }
            return newObject;
        }
Posté le : 28/08/2006 16:46:46

1


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,780 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales