FontFamily.GetHashCode Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a hash code for this FontFamily.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public override int GetHashCode()

Return Value

Type: System.Int32

The hash code for this FontFamily.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates a FontFamily.

  • Gets the hash code for the font family.

  • Draws the value of the hash code to the screen as text.

public void GetHashCode_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily myFontFamily = new FontFamily("Arial");

    // Get the hash code for myFontFamily.
    int hashCode = myFontFamily.GetHashCode();

    // Draw the value of hashCode to the screen as a string.
    e.Graphics.DrawString(
        "hashCode = " + hashCode.ToString(),
        new Font(myFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}

.NET Framework
Available since 1.1
Return to top
Show: