Joined July 2024
116 Photos and videos
Pinned Tweet
๐Ÿ˜ฎโ€๐Ÿ’จTired of writing the same math method multiple times for int, double, and decimal? C# 11 introduced Generic Math โ€” constrain T to INumber and the , -, *, / operators just work. One method. Any numeric type. Full type safety. ๐Ÿš€
1
1
29
Master C#'s TimeProvider for ultimate time control! Hardcoding DateTime.Now or DateTimeOffset.UtcNow makes your code impossible to test reliably. .NET 8 introduced TimeProvider โ€” an injectable abstraction for time that lets you freeze, advance, or mock time in tests without any hacks.
20
C# 14 introduces extension blocks โ€” a cleaner way to add methods, properties, and operators to existing types. They unify extension members, reduce boilerplate, and make type extension more expressive without modifying the original type.
15
C# 11's Raw String Literals simplify multi-line strings embedded in your code. No more escaping quotes or special characters. Easy interpolation even with curly braces that you want to escape. Visual Studio and the C# Dev Kit provide some validation and syntax highlighting when raw string literals contain JSON data or regular expressions. You can help this mechanism using a dedicated comment above the literal.
55
โœจ C# 12 introduced Collection Expressions It's a cleaner, more expressive syntax for initializing arrays, lists, spans, and even ImmutableArrays using simple square brackets `[ ]`. The spread operator `..` lets you merge existing collections inline. No more chaining `.Concat()`, `.Append()`, and `.ToArray()` just to combine two arrays.
16
Did you know C# can automatically capture the text of an argument passed to a method? No more "Value cannot be null" without knowing which value. Perfect for validation and assertion utilities.
25
C# Tip: Ever had a null check that silently lied to you? In C#, != null can be overloaded by a class to return whatever it wants. is not null bypasses that entirely. It's a pattern match against the actual reference, not an operator call. Small difference, big consequences.
1
1
34
๐Ÿ”ฅ C#: Add new interface members without breaking existing implementations! With default interface implementations (C# 8 ), you can add a method directly to an interface with a default body โ€” classes that already implement the interface don't need to change a thing. Perfect for evolving library APIs without forcing every consumer to update. ๐Ÿ’ฌ Do you use default interface implementations in your projects, or do you prefer extension methods (or blocks) / abstract base classes for this?
1
41
๐Ÿง  JavaScript Proxies allow you to wrap an object and intercept operations like property access, assignment, deletion, and even function calls. You define a handler with traps that customize behavior. Perfect for logging and validation.
1
76
โœจ C# Tip Easily generate sequences of numbers within a specified range using Enumerable.Range(). Define your start & count to get exactly what you need for loops, arrays, or tests. Simplify your code!
1
41
Improve your C# loops! The new LINQ Index() method makes iterating with both item and index really simple. Forget verbose Select - now you can even set a custom startIndex (0-based, 1-based). Clean, concise, and powerful!
1
77
C#: Need to process data in batches? LINQ's Chunk(n) method is your go-to! Easily split any sequence into fixed-size chunks. Super clean and easy to use.
2
54
Collection Expressions are a feature from C# 12 that let you initialize arrays, lists, spans, and even ImmutableArray using square brackets. It can even spread existing collections into new ones. Looks familiar to JavaScript devs, isn't it?๐Ÿ˜‰
1
83
Did you know Array.prototype.flat() can flatten arrays of any deep? While by default it flattens arrays by a depth of 1, its true power comes when you pass the Infinity argument. This little-known trick allows you to flatten arrays of unknown deepness.
2
2
47
C# trick: Use local functions to boost clarity and performance. They capture locals more efficiently than lambdas, avoid delegate allocations, keep logic scoped where it belongs, and can even be generic. Cleaner, faster code in one move.
1
74
JS Tip: Need to replace an array element at an index WITHOUT mutating the original array? ๐Ÿคฏ Meet Array.prototype.with()! It creates a NEW array with the update, keeping your source data pristine.
2
2
60
New C# nameof trick! ๐Ÿ’ฅ Get the name of any generic type (like List<> or Dictionary<,>) without specifying its type arguments. Super handy for reflection, logging, or dynamic scenarios!
1
66
C# Tuples Deconstruction = ๐Ÿ”ฅ Easily extract multiple values from method returns into separate variables. Clean, concise, and super readable. What's your preferred way to return multiple values?
58
Every time I simplify a piece of code, I feel like Iโ€™m paying off debt I didnโ€™t know I had.
40
The most underrated engineering skill is noticing when something feels โ€˜offโ€™ before it breaks. Intuition is pattern recognition in disguise.
1
25