mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Update Modern Syntax range to C# 10-14 and add unbound generics nameof example
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/8cdef112-415b-4769-877d-61f0e7a300eb
This commit is contained in:
parent
4ac3601aa7
commit
95fc0fd0f8
1 changed files with 3 additions and 2 deletions
|
|
@ -287,7 +287,7 @@ using PacketMap = System.Collections.Generic.Dictionary<int, System.Action<byte[
|
|||
var greet = (string name, string prefix = "Player") => $"{prefix} {name}";
|
||||
```
|
||||
|
||||
## Modern Syntax (C# 10–12)
|
||||
## Modern Syntax (C# 10–14)
|
||||
|
||||
### File-Scoped Namespaces
|
||||
|
||||
|
|
@ -961,9 +961,10 @@ public bool IsAlive => Health > 0;
|
|||
_ = int.TryParse(s, out int result);
|
||||
(_, int y, _) = GetCoordinates();
|
||||
|
||||
// CORRECT: nameof for resilient refactoring
|
||||
// CORRECT: nameof for resilient refactoring (unbound generics in C# 14)
|
||||
throw new ArgumentException("Invalid value", nameof(packetId));
|
||||
LogToConsole($"{nameof(AutoEat)}: eating {item.Name}");
|
||||
string typeName = nameof(Dictionary<,>); // "Dictionary"
|
||||
|
||||
// CORRECT: static lambdas prevent accidental closure allocations
|
||||
list.Sort(static (a, b) => a.Id.CompareTo(b.Id));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue