dotnet / dotnet/dotnet-api-docs

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

Ouverte
#11,633 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
area-System.Drawing untriaged
Langage dominant
C#
Étoiles
950
Forks
1.7k
Merge moyen
2 j 19 h
PR mergées (30 j)
52

Description

### 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Ouvrez xml/System.Drawing/Rectangle.xml et repérez les remarques de Rectangle.Union décrites dans l’issue. Comparez le texte source avec la page d’API liée, puis mettez à jour les remarques afin qu’elles ne décrivent plus le comportement incorrect des rectangles vides. Le travail est terminé lorsque le code source est corrigé et que la documentation générée n’affiche plus cette affirmation.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
documentation
Type d'issue
Documentation
Difficulté
1/5
Temps estimé
Moins d'une heure
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.