dotnet / dotnet/winforms

Font.Clone() not creating an exact copy?

Open
#8,821 10 comments 0 reactions 1 assignee Claimed by @safern View on GitHub
area-System.Drawing
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

According to the documentation, `Font.Clone()`

> Creates an exact copy of this Font.

But running the following code:
```
Font f1 = new Font("MS Outlook", 2.5f);
Font f2 = (Font)f1.Clone();

Font f3 = new Font("Arial", 2.5f);
Font f4 = (Font)f3.Clone();

Console.WriteLine(f1.Equals(f2));
Console.WriteLine(f3.Equals(f4));
```

Gives the result:

> False
> True

This is likely due to MS Outlook not being installed on my machine, but does this still not contradict the documentation? An **exact** copy should equal its original, otherwise it is not an exact copy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.