/// <summary> /// Determines whether [is property required] [the specified property name]. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns> /// <c>true</c> if [is property required] [the specified property name]; otherwise, <c>false</c>. /// </returns> public bool IsPropertyRequired(string propertyName) { var requiredPropertyFlagsType = RequiredFlags.GetType(); var property = requiredPropertyFlagsType.GetProperty(propertyName); return((bool)property.GetValue(RequiredFlags, null)); }
public override int GetHashCode() { unchecked { int hashCode = 0; foreach (string commandName in CommandNames) { hashCode = (hashCode * 397) ^ commandName.GetHashCode(); } foreach (KeyValuePair <string, IArgumentTaker> option in Options) { hashCode = (hashCode * 397) ^ option.Key.GetHashCode(); hashCode = (hashCode * 397) ^ option.Value.GetHashCode(); } foreach (IArgumentTaker argument in Arguments) { hashCode = (hashCode * 397) ^ argument.GetHashCode(); } foreach (string tag in Tags) { hashCode = (hashCode * 397) ^ tag.GetHashCode(); } hashCode = (hashCode * 397) ^ RequiredFlags.GetHashCode(); hashCode = (hashCode * 397) ^ ForbiddenFlags.GetHashCode(); return(hashCode); } }
public MessageTypeInfo( string aName, int?aLength = null, bool aRepeatable = false, RequiredFlags aRequiredFor = RequiredFlags.None) { Name = aName; Length = aLength; IsRepeatable = aRepeatable; RequiredFor = aRequiredFor; }
/// <summary> /// Checks to see if this messag typ eis required for a type of object /// </summary> /// <returns><c>true</c>, if for was requireded, <c>false</c> otherwise.</returns> /// <param name="aMessageType">A message type.</param> /// <param name="aFlags">Type of object to check for.</param> public static bool RequiredFor(this MessageType aMessageType, RequiredFlags aFlags) => (msrTypeInfo[aMessageType].RequiredFor | aFlags) != 0;