public string ShouldFormatObjectAccordingToDensity(ObjectFormatOptions options) { var account = new Account(19, "John", "12-33-19", "66-18-23"); var format = new ObjectFormat() .AddFlags(options) .ObjectBodyPrefixAndSuffix("<", ">") .ObjectMemberNamePrefixAndSuffix("'", "'") .ObjectMemberValuePrefixAndSuffix("\"", "\"") .JoinMemberNameAndValueWith(":") .JoinMembersWith(","); return(format.Compile(AccountMembers)(account)); }
/// <summary> /// Sets density flag and returns updated format instance. /// </summary> /// <param name="options">Density flag(s) to set.</param> /// <returns>Updated <see cref="ObjectFormat" /> instance.</returns> public ObjectFormat AddFlags(ObjectFormatOptions options) { Options |= options; return(this); }
/// <summary> /// Deactivates density flag and returns updated format instance. /// </summary> /// <param name="options">Density flag(s) to negate.</param> /// <returns>Updated <see cref="ObjectFormat" /> instance.</returns> public ObjectFormat RemoveFlags(ObjectFormatOptions options) { Options &= Options ^ options; return(this); }