Matrix.HasInverse Property

Gets a value that indicates whether this Matrix structure is invertible.

Namespace: System.Windows.Media
Assembly: WindowsBase (in windowsbase.dll)
XML Namespace:

public bool HasInverse { get; }
/** @property */
public boolean get_HasInverse ()

public function get HasInverse () : boolean

You cannot use this property in XAML.

Property Value

true if the Matrix has an inverse; otherwise, false. The default is true.

The following example checks whether a Matrix is invertible. If it is invertible, the Matrix is inverted.

private Matrix inverseExample()
    // Creating a Matrix structure.
    Matrix myMatrix = new Matrix(5, 10, 15, 20, 25, 30);
    // Checking if myMatrix is invertible.
    if (myMatrix.HasInverse)

        // Invert myMatrix. myMatrix is now 
        // equal to (-0.4, 0.2 , 0.3, -0.1, 1, -2) 
        // Return the inverted matrix.
        return myMatrix;
        throw new InvalidOperationException("The matrix is not invertible.");


Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0