dotnet / dotnet/dotnet-api-docs
The Rectangle.Union remarks indicate a behavior that is not seen and unreasonable.
- Lingua principale
- C#
- Stelle
- 949
- Fork
- 1.7k
- Merge medio
- 3g 27m
- PR unite (30g)
- 49
Descrizione
### 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. 🚧
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Open xml/System.Drawing/Rectangle.xml and locate the Rectangle.Union remarks described in the issue. Compare the source text with the linked API page, then update the remarks so they no longer describe the incorrect empty-rectangle behavior. Done means the source is corrected and the generated documentation no longer shows that claim.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100