) GetPropertyStuff(IPropertySymbol symbol, SyntaxNode syntax) { bool isInitOnly = symbol.SetMethod != null && symbol.SetMethod.IsInitOnly; // init-only is as good as readonly for the rest of the analyzer. bool isReadOnly = isInitOnly || symbol.IsReadOnly; return(syntax switch { PropertyDeclarationSyntax prop => ( prop.Type, prop.Identifier, // Only return the initializer syntax for readonly // properties. init-only properties can be overwritten by // callers (rather than just constructors) which are well // outside the scope of our analysis. isInitOnly ? null : prop.Initializer?.Value, prop.IsAutoImplemented(), isReadOnly ), ParameterSyntax param => ( param.Type, param.Identifier, // We never care about initializers for these types of // properties because they are always init-only and can // be overwritten by any caller. Initializer : null, IsAutoImplemented : true, isReadOnly ), _ => throw new NotImplementedException() });