MongoDB.Bson.Serialization.BsonMemberMap.SetShouldSerializeMethod C# (CSharp) Метод

SetShouldSerializeMethod() публичный Метод

Sets the method that will be called to determine whether the member should be serialized.
public SetShouldSerializeMethod ( bool>.Func shouldSerializeMethod ) : BsonMemberMap
shouldSerializeMethod bool>.Func The method.
Результат BsonMemberMap
        public BsonMemberMap SetShouldSerializeMethod(Func<object, bool> shouldSerializeMethod)
        {
            if (_frozen) { ThrowFrozenException(); }
            _shouldSerializeMethod = shouldSerializeMethod;
            return this;
        }

Usage Example

		public void Apply(BsonMemberMap memberMap)
		{
			if (memberMap.MemberName.StartsWith("_"))
				memberMap.SetShouldSerializeMethod(o => false);
		}