Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AllowNull属性の利用例が実際と異なっている #452

Open
benutomo-dev opened this issue Sep 30, 2023 · 0 comments
Open

AllowNull属性の利用例が実際と異なっている #452

benutomo-dev opened this issue Sep 30, 2023 · 0 comments

Comments

@benutomo-dev
Copy link

null 許容参照型4ページ目のアノテーション属性の利用例の中にあるAllowNull属性の例が実際と異なっているようです。

記載されている説明では、

TextWriter.NewLine は get で null を返すことはありません。 しかし、「null を set すると Environment.NewLine を使う」という仕様があって、set だけが null 許容です。 そこで、以下のように、set にだけ AllowNull が付いています。

となっていますが、.NET Source Browserで見ることできる現状のコードではAllowNull属性はsetではなくプロパティ側についていました。

現在のAllowNull属性の定義ではAttributeTargetsMethodが含まれていないため、setだけにAllowNull属性を指定すること自体ができないはずです。preview段階のソースなどを参考にした例がそのまま残ったりしてしまっているのではないでしょうか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant