MongoDB.Bson.Serialization.Conventions.ReadWriteMemberFinderConvention.Apply C# (CSharp) Method

Apply() public method

Applies a modification to the class map.
public Apply ( BsonClassMap classMap ) : void
classMap BsonClassMap The class map.
return void
        public void Apply(BsonClassMap classMap)
        {
            // order is important for backwards compatibility and GetMembers changes the order of finding things.
            // hence, we'll check member types explicitly instead of letting GetMembers handle it.

            if ((_memberTypes & MemberTypes.Field) == MemberTypes.Field)
            {
                var fields = classMap.ClassType.GetFields(_bindingFlags);
                foreach (var field in fields)
                {
                    MapField(classMap, field);
                }
            }

            if ((_memberTypes & MemberTypes.Property) == MemberTypes.Property)
            {
                var properties = classMap.ClassType.GetProperties(_bindingFlags);
                foreach (var property in properties)
                {
                    MapProperty(classMap, property);
                }
            }
        }