System.Xml.Serialization.TypeScope.CanWriteProperty C# (CSharp) Method

CanWriteProperty() private static method

private static CanWriteProperty ( PropertyInfo propertyInfo, TypeDesc typeDesc ) : bool
propertyInfo System.Reflection.PropertyInfo
typeDesc TypeDesc
return bool
        private static bool CanWriteProperty(PropertyInfo propertyInfo, TypeDesc typeDesc)
        {
            Debug.Assert(propertyInfo != null);
            Debug.Assert(typeDesc != null);

            // If the property is a collection, we don't need a setter.
            if (typeDesc.Kind == TypeKind.Collection || typeDesc.Kind == TypeKind.Enumerable)
            {
                return true;
            }
            // Else the property needs a public setter.
            return propertyInfo.SetMethod != null && propertyInfo.SetMethod.IsPublic;
        }