# Complex.Magnitude 属性

## 定义

``````public:
property double Magnitude { double get(); };``````
``public double Magnitude { get; }``
``member this.Magnitude : double``
``Public ReadOnly Property Magnitude As Double``

## 示例

``````using System;
using System.Numerics;

public class Example
{
public static void Main()
{
Complex complex1 = new Complex(2.0, 3.0);
Console.WriteLine("|{0}| = {1:N2}", complex1, Complex.Abs(complex1));
Console.WriteLine("Equal to Magnitude: {0}",
Complex.Abs(complex1).Equals(complex1.Magnitude));
}
}
// The example displays the following output:
//       |(2, 3)| = 3.60555127546399
//       Equal to Magnitude: True
``````
``````Imports System.Numerics

Module Example
Public Sub Main()
Dim complex1 As New Complex(2.0, 3.0)
Console.WriteLine("|{0}| = {1:N2}", complex1, Complex.Abs(complex1))
Console.WriteLine("Equal to Magnitude: {0}",
Complex.Abs(complex1).Equals(complex1.Magnitude))
End Sub
End Module
' The example displays the following output:
'       |(2, 3)| = 3.61
'       Equal to Magnitude: True
``````

## 注解

Magnitude 属性等效于复数的绝对值。The Magnitude property is equivalent to the absolute value of a complex number. 它指定从原点（笛卡尔坐标系统中的 x 轴和 y 轴的交点）到复数表示的二维点之间的距离。It specifies the distance from the origin (the intersection of the x-axis and the y-axis in the Cartesian coordinate system) to the two-dimensional point represented by a complex number. 计算绝对值的方法如下：The absolute value is calculated as follows:

|a + bi | = Math.Sqrt（a * a + b * b）| a + bi | = Math.Sqrt(a * a + b * b)

MagnitudePhase 属性定义表示极坐标系统中的复数的点的位置。The Magnitude and the Phase properties define the position of a point that represents a complex number in the polar coordinate system.