/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { int result = BcdUsb.GetHashCode(); result = (result * 397) ^ Class.GetHashCode(); result = (result * 397) ^ SubClass.GetHashCode(); result = (result * 397) ^ Protocol.GetHashCode(); result = (result * 397) ^ MaxPacketSize0.GetHashCode(); result = (result * 397) ^ VendorID.GetHashCode(); result = (result * 397) ^ ProductID.GetHashCode(); result = (result * 397) ^ BcdDevice.GetHashCode(); result = (result * 397) ^ ManufacturerStringIndex.GetHashCode(); result = (result * 397) ^ ProductStringIndex.GetHashCode(); result = (result * 397) ^ SerialStringIndex.GetHashCode(); result = (result * 397) ^ ConfigurationCount.GetHashCode(); return(result); } }
///<summary> ///Returns a <see cref="T:System.String"/> that represents the current <see cref="UsbDeviceDescriptor"/>. ///</summary> /// ///<param name="prefixSeperator">The field prefix string.</param> ///<param name="entitySperator">The field/value seperator string.</param> ///<param name="suffixSeperator">The value suffix string.</param> ///<returns>A formatted representation of the <see cref="UsbDeviceDescriptor"/>.</returns> public string ToString(string prefixSeperator, string entitySperator, string suffixSeperator) { Object[] values = { Length, DescriptorType, "0x" + BcdUsb.ToString("X4"), Class, "0x" + SubClass.ToString("X2"), "0x" + Protocol.ToString("X2"), MaxPacketSize0, "0x" + VendorID.ToString("X4"), "0x" + ProductID.ToString("X4"), "0x" + BcdDevice.ToString("X4"), ManufacturerStringIndex, ProductStringIndex, SerialStringIndex, ConfigurationCount }; string[] names = { "Length", "DescriptorType", "BcdUsb", "Class", "SubClass", "Protocol", "MaxPacketSize0", "VendorID", "ProductID", "BcdDevice", "ManufacturerStringIndex", "ProductStringIndex", "SerialStringIndex", "ConfigurationCount" }; return(Helper.ToString(prefixSeperator, names, entitySperator, values, suffixSeperator)); }