Beispiel #1
0
 internal XamlMember(string name, string preferredNamespace)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     Name = name;
     flags.Set(MemberFlags.IsUnknown, true);
     ns.Set(preferredNamespace);
 }
Beispiel #2
0
        internal bool ShouldSerialize(object instance)
        {
            var shouldSerialize = flags.Get(MemberFlags.ShouldSerialize) ?? flags.Set(MemberFlags.ShouldSerialize, LookupShouldSerialize());

            if (!shouldSerialize)
            {
                return(false);
            }

            if (!shouldSerializeMethod.HasValue)
            {
                shouldSerializeMethod.Set(LookupShouldSerializeMethod());
            }

            if (shouldSerializeMethod.Value != null)
            {
                return((bool)shouldSerializeMethod.Value.Invoke(instance, null));
            }

            return(true);
        }