コード例 #1
0
        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));
        }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
 }