dotnet / dotnet/dotnet-api-docs

The Rectangle.Union remarks indicate a behavior that is not seen and unreasonable.

オープン
#11,633 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area-System.Drawing untriaged
主要言語
C#
スター
949
フォーク
1.7k
平均マージ
2日 19時間
マージ済み PR(30日)
52

説明

### Type of issue

Crazy, Incorrect Remarks

### Description

The remarks are incorrect and would be very weird *if they were correct*.

🚧 THE REMARKS SHOULD BE REMOVED. 🚧

The remarks state:

> When one of the two rectangles is empty, meaning all of its values are zero, the [Union](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.rectangle.union?view=net-9.0) method returns a rectangle with a starting point of (0, 0), and the height and width of the non-empty rectangle. For example, if you have two rectangles: A = (0, 0; 0, 0) and B = (1, 1; 2, 2), then the union of A and B is (0, 0; 2, 2).

However, using the exact values from the remarks does not give the value promised.

// Declare two rectangles and draw them.
var rectangle1 = new Rectangle(0, 0, 0, 0);
var rectangle2 = new Rectangle(1, 1, 2, 2);
g.DrawRectangle(Pens.Sienna, rectangle1);
g.DrawRectangle(Pens.BlueViolet, rectangle2);

// Declare a third rectangle as a union of the first two.
var rectangle3 = Rectangle.Union(rectangle1, rectangle2).Dump();

Result:

> {X=0,Y=0,**Width=3,Height=3**}

🚧 THIS IS CORRECT AND REASONABLE. THE REMARKS ARE UNNECESSARY AND INCORRECT. 🚧

Image

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.drawing.rectangle.union?view=net-9.0&devlangs=csharp&f1url=%3FappId%3DDev17IDEF1%26l%3DEN-US%26k%3Dk(System.Drawing.Rectangle.Union)%3Bk(DevLang-csharp)%26rd%3Dtrue

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Drawing/Rectangle.xml

### Document Version Independent Id

71367ba3-b782-10ab-e718-4151739eaafa

### Platform Id

5aef8bd6-6060-ace5-8d11-a512d660587e

### Article author

@dotnet-bot

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

xml/System.Drawing/Rectangle.xml を開き、issue で説明されている Rectangle.Union の remarks を見つけます。ソーステキストをリンクされた API ページと比較し、空の矩形に関する誤った動作を説明しないよう remarks を更新します。ソースが修正され、生成されたドキュメントにその記述が表示されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。