c-sharp-code-examples
c-sharp-code-examples copied to clipboard
C# Code Examples / Snippets
C# Code Examples (mostly for myself)
A collection of code samples I have used C# and think they might be useful in the future.
Sample Categories
- Abstract Class
- Anonymous Types
- Attributes and Conditionals
- Debugger
DebuggerDisplayDebuggerBrowsableConditional#if - #define - #endif
Obsolete- Compiler Warning
- Compiler Error
Conditional
- Debugger
- Classes
- Get current Class name
- Get current Method Name
- Constructor Chaining
- Caller Info
- Comparing
- Design Patterns
- Creational Patterns
- Singleton Pattern
- Factory Method Pattern
- Abstract Factory Pattern
- Behavioral Patterns
- Strategy Pattern
- Observer Pattern
- State Pattern
- Creational Patterns
- Dictionaries
DictionaryAdditional links: LinkOrderedDictionary(requiresSystem.Collections.Specialized); Additional links: LinkSortedDictionaryAdditional links: Link
- Extension Methods
- Garbage Collection
- Implicit/Explicit Conversion operators
- Interface
LINQ- Sum
- Sum by Groups
- Ordering (asc, desc)
- Skipping
- Take N elements
- Select Samples with value between
- Object Pool
- Operator Overloading Additional links: Link
- SOLID
- Single Responsibility Principle
- Inversion of Control
- Syntactic Sugars
- Auto Property
- Auto Property with default value
- Property getter/setter
- String Interpolation
- Using
- Pattern Matching
- Threading
BackgroundWorkerThread
- Timing
- Tuple Deconstruction (requires
System.ValueTuple); Additional links: Link
Useful Libraries
Universal
- Excel (Native)
- QR Codes
- JSON
- Logging
- ORM
WPF Specific
- UI/UX
- Frameworks
- Iconpacks