mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Fix C# examples in documentation
- Fix documentation after C# renames. - Add missing `partial` in C# class declarations. - Change `delta` parameter type to `double` in C#. - Ensure parameters match base declaration. - Use `$` string interpolation in C#. - Fix invalid or outdated C# code. - Changed some examples to follow our style guide more closely.
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
|
||||
string queryString = new HTTPClient().QueryStringFromDict(fields);
|
||||
string queryString = httpClient.QueryStringFromDict(fields);
|
||||
// Returns "username=user&password=pass"
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@@ -117,8 +117,13 @@
|
||||
# Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44"
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
var fields = new Godot.Collections.Dictionary{{"single", 123}, {"notValued", null}, {"multiple", new Godot.Collections.Array{22, 33, 44}}};
|
||||
string queryString = new HTTPClient().QueryStringFromDict(fields);
|
||||
var fields = new Godot.Collections.Dictionary
|
||||
{
|
||||
{ "single", 123 },
|
||||
{ "notValued", default },
|
||||
{ "multiple", new Godot.Collections.Array { 22, 33, 44 } },
|
||||
};
|
||||
string queryString = httpClient.QueryStringFromDict(fields);
|
||||
// Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44"
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@@ -151,7 +156,7 @@
|
||||
[csharp]
|
||||
var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } };
|
||||
string queryString = new HTTPClient().QueryStringFromDict(fields);
|
||||
string[] headers = {"Content-Type: application/x-www-form-urlencoded", "Content-Length: " + queryString.Length};
|
||||
string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" };
|
||||
var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString);
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
|
||||
Reference in New Issue
Block a user