Beispiel #1
0
        private bool TryGetBytesForInt(int size, out byte[] bytes)
        {
            if (ByteArrayValue == null || ByteArrayValue.Skip(size).Any(b => b != 0))
            {
                bytes = default(byte[]);
                return(false);
            }

            bytes = ByteArrayValue.Take(size).ToArray();
            return(true);
        }
        /// <summary>
        /// Overrode method from System.Object.
        /// </summary>
        /// <param name="obj">The object to be compared.</param>
        /// <returns>True if obj has same data with this instance. False if not.</returns>
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Asn1String return false.
            Asn1BitString p = obj as Asn1BitString;

            if ((System.Object)p == null)
            {
                return(false);
            }

            // Return true if the fields match.
            return(ByteArrayValue.SequenceEqual <byte>(p.ByteArrayValue) &&
                   this.unusedBitsInLastByte == p.unusedBitsInLastByte);
        }