Performance[edit]
In computer science, an associative array, map, symbol table, or dictionary is an abstract data type composed of a collection of (key, value) pairs, such that each possible key appears at most once in the collection... dictionary problem, a classic computer science problem... two major solutions to the dictionary problem are a hash table and a search tree... directly addressed arrays, binary search trees... tree is reasonably balanced, which is to say the leaves at either end are of comparable depths... advantage is that B-trees do not need to be re-balanced as frequently
Lookup times are different in List and Dictionary... O(1) constant time complexity. The List has an O(N)
Variables[edit]
прохання всім при оголошенні змінної з ініціалізацією не вказувати явно тип а писати var. І утримуватись від оголошень змінних без одночасної ініціалізації.
тобто, замість:
string regexInvalidPathChars = "[" + Regex.Escape(wrongSymbols) + "]";
хотілось би бачити як:
var regexInvalidPathChars = "[" + Regex.Escape(wrongSymbols) + "]";
а замість
SomeClass obj = SessionLoad("bla-bla");
мати:
var obj = SessionLoad("bla-bla") as SomeClass;
LINQ[edit]
.Contains(pr); // better than
.Exists(mf => string.Compare(mf, pr) == 0);
delegate[edit]
lambdas are just syntactic sugar for anonymous delegates
runtime[edit]
System.Drawing[edit]
System.Drawing.Common is not supported on non-Windows platforms.
System.Drawing.Common only supported on Windows... Starting in .NET 6, the platform analyzer emits compile-time warnings when referencing code is compiled for non-Windows operating systems. In addition, the following run-time exception is thrown
other C# guides[edit]
Pages in category "CSharp coding guide"
The following 7 pages are in this category, out of 7 total.