diff --git a/getting_started/scripting/c_sharp/c_sharp_differences.rst b/getting_started/scripting/c_sharp/c_sharp_differences.rst index b84daeae6..9c7725009 100644 --- a/getting_started/scripting/c_sharp/c_sharp_differences.rst +++ b/getting_started/scripting/c_sharp/c_sharp_differences.rst @@ -25,14 +25,14 @@ Global functions like ``print``, ``var2str`` and ``weakref`` are located under Math ---- -Math functions like ``abs``, ``acos``, ``asin``, ``atan`` and ``atan2`` are +Math functions, like ``abs``, ``acos``, ``asin``, ``atan`` and ``atan2``, are located under ``Mathf`` as ``Abs``, ``Acos``, ``Asin``, ``Atan`` and ``Atan2``, instead of in global scope. ``PI`` is ``Mathf.Pi`` Random ------ -Random functions like ``rand_range`` and ``rand_seed`` are located under ``Random``, +Random functions, like ``rand_range`` and ``rand_seed``, are located under ``Random``, so use ``Random.RandRange`` instead of ``rand_range``. Export keyword @@ -74,14 +74,14 @@ by the ``StringExtensions`` class as extension methods. Example: string upper = "I LIKE SALAD FORKS"; string lower = upper.ToLower(); -There are a few differences though: +There are a few differences, though: * ``erase``: Strings are immutable in C#, so we cannot modify the string - passed to the extension method. For this reason ``Erase`` was added as an + passed to the extension method. For this reason, ``Erase`` was added as an extension method of ``StringBuilder`` instead of string. - Alternatively you can use ``string.Remove``. -* ``IsSubsequenceOf``/``IsSubsequenceOfi``: An additional method is provided - which is an overload of ``IsSubsequenceOf`` allowing to explicitly specify + Alternatively, you can use ``string.Remove``. +* ``IsSubsequenceOf``/``IsSubsequenceOfi``: An additional method is provided, + which is an overload of ``IsSubsequenceOf``, allowing you to explicitly specify case sensitivity: .. code-block:: csharp @@ -92,7 +92,7 @@ There are a few differences though: str.IsSubsequenceOf("ok", false); // Case insensitive * ``Match``/``Matchn``/``ExprMatch``: An additional method is provided besides - ``Match`` and ``Matchn``, which allows to explicitly specify case sensitivity: + ``Match`` and ``Matchn``, which allows you to explicitly specify case sensitivity: .. code-block:: csharp @@ -104,11 +104,11 @@ There are a few differences though: Basis ----- -Structs cannot have parameterless constructors in C#, therefore ``new Basis()`` +Structs cannot have parameterless constructors in C#. Therefore, ``new Basis()`` initializes all primitive members to their default value. Use ``Basis.Identity`` -for the equivalent to ``Basis()`` in GDScript and C++. +for the equivalent of ``Basis()`` in GDScript and C++. -The following methods were converted to properties with their respective names changed: +The following method was converted to a property with a different name: ================ ================================================================== GDScript C# @@ -119,9 +119,9 @@ get_scale() Scale Transform2D ----------- -Structs cannot have parameterless constructors in C#, therefore ``new Transform2D()`` +Structs cannot have parameterless constructors in C#. Therefore, ``new Transform2D()`` initializes all primitive members to their default value. -Please use ``Transform2D.Identity`` for the equivalent to ``Transform2D()`` in GDScript and C++. +Please use ``Transform2D.Identity`` for the equivalent of ``Transform2D()`` in GDScript and C++. The following methods were converted to properties with their respective names changed: @@ -136,7 +136,7 @@ get_scale() Scale Plane ----- -The following methods were converted to properties with their respective names changed: +The following method was converted to a property with a *slightly* different name: ================ ================================================================== GDScript C# @@ -147,7 +147,7 @@ center() Center Rect2 ----- -The following fields were converted to properties with their respective names changed: +The following field was converted to a property with a *slightly* different name: ================ ================================================================== GDScript C# @@ -155,7 +155,7 @@ GDScript C# end End ================ ================================================================== -The following methods were converted to properties with their respective names changed: +The following method was converted to a property with a different name: ================ ================================================================== GDScript C# @@ -166,9 +166,9 @@ get_area() Area Quat ---- -Structs cannot have parameterless constructors in C#, therefore ``new Quat()`` +Structs cannot have parameterless constructors in C#. Therefore, ``new Quat()`` initializes all primitive members to their default value. -Please use ``Quat.Identity`` for the equivalent to ``Quat()`` in GDScript and C++. +Please use ``Quat.Identity`` for the equivalent of ``Quat()`` in GDScript and C++. Array ----- @@ -189,7 +189,7 @@ PoolVector2Array Vector2[] PoolVector3Array Vector3[] ================ ================================================================== -In some exceptional cases a raw array (``type[]``) may be required instead of a ``List``. +In some exceptional cases, a raw array (``type[]``) may be required instead of a ``List``. Dictionary ---------- @@ -201,7 +201,7 @@ Use ``Dictionary``. Variant ------- -``System.Object`` (``object``) is used in place of ``Variant``. +``System.Object`` (``object``) is used instead of ``Variant``. Communicating with other scripting languages -------------------------------------------- @@ -214,7 +214,7 @@ scripting languages via the Variant API. Other differences ----------------- -``preload``, ``assert`` and ``yield`` as they work in GDScript are currently +``preload``, ``assert`` and ``yield``, as they work in GDScript, are currently not available in C#. Other differences: @@ -227,5 +227,5 @@ is_inf float.IsInfinity is_nan float.IsNaN dict2inst ? TODO inst2dict ? TODO -load GD.load which is the same as ResourceLoader.load +load GD.load, which is the same as ResourceLoader.load ================ ==================================================================