Beispiel #1
0
        PropertyDeclarationSyntax MakeWriterRefTypeProperty(
            TypeSyntax type,
            string name,
            ExpressionSyntax getter,
            ExpressionSyntax setter,
            bool cast,
            bool cond)
        {
            if (cond)
            {
                type = _names.MakeNullableRefType(type);
            }

            var prop = MakeWriterProperty(type, name, getter, setter, cast, cond);

            if (cond && _names.NullableEnable)
            {
                prop = prop.AddAttributeLists(
                    AttributeList(
                        SingletonSeparatedList(
                            Attribute(
                                IdentifierName("DisallowNull")))));
            }
            return(prop);
        }