iTextSharp.text.pdf.PdfName.CompareTo C# (CSharp) Метод

CompareTo() публичный Метод

public CompareTo ( Object obj ) : int
obj Object
Результат int
        public int CompareTo(Object obj) {
            PdfName name = (PdfName) obj;
        
            byte[] myBytes = bytes;
            byte[] objBytes = name.bytes;
            int len = Math.Min(myBytes.Length, objBytes.Length);
            for (int i=0; i<len; i++) {
                if (myBytes[i] > objBytes[i])
                    return 1;
            
                if (myBytes[i] < objBytes[i])
                    return -1;
            }
            if (myBytes.Length < objBytes.Length)
                return -1;
            if (myBytes.Length > objBytes.Length)
                return 1;
            return 0;
        }
    

Usage Example

Пример #1
0
        // methods concerning the type of Dictionary

        /**
         * Checks if a <CODE>PdfDictionary</CODE> is of a certain type.
         *
         * @param		type	a type of dictionary
         * @return		<CODE>true</CODE> of <CODE>false</CODE>
         *
         * @deprecated
         */

        public bool isDictionaryType(PdfName type)
        {
            return(dictionaryType.CompareTo(type) == 0);
        }