public static class X { /// Easy with structs</remarks public static bool TryGetValue(this T? nullable, ref T value) where T : struct { if (nullable.HasValue) { value = nullable.Value; return true; }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Extensions | |
{ | |
/// <summary> | |
/// Try to get the single value from the collection | |
/// </summary> | |
/// <typeparam name="T">The type of elements in the collection</typeparam> | |
/// <param name="source">the source collection</param> | |
/// <param name="predicate">The predicate to test elements</param> | |
/// <param name="item">The item found, or null</param> | |
/// <returns>true if found, false otherwise</returns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Some extensions for <seealso cref="ImmutableList{T}"/> | |
/// </summary> | |
public static class ImmutableListExtensions | |
{ | |
/// <summary> | |
/// Replace <paramref name="value"/> in <paramref name="source"/> based on object equality | |
/// </summary> | |
/// <remarks> | |
/// This method depends on the <typeparamref name="T"/> implementing Object.Equals, if it does not, |
The structure of IPv4 addresses lies at the core of the internet's architecture
- does calling out IPv4 mean many of the details in this chapter apply to IPv6?
- "Locator" in what sense?
[Just as a street address indicates a specific location, an IP address designates a particular device on a network. The subnet mask, analogous to the zip code, guides data packets to their intended destination.](https://cwoodruff.github.io/book-network-programming-csharp/chapter02/#:~:text=just%20as%20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build --> | |
<PropertyGroup> | |
</PropertyGroup> | |
<Target Name="PostClean" AfterTargets="Clean"> | |
<RemoveDir Directories="$(BaseIntermediateOutputPath)" /> | |
<RemoveDir Directories="$(BaseOutputPath)" /> | |
</Target> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# e.g.: | |
. .\visual-studio-classes.ps1 | |
$csproj = [Project]::CreateClassLib(".\Solution\ClassLib\ClassLib.csproj"); | |
$csproj.AddClass('MyClass'); | |
#> | |
class Project { | |
[string]$Folder; | |
Project() { |
Search for
^(?'tab'\s*)try\s*\r?\n+\k<tab>\{\r?\n(?'tried'(.*\r?\n)+)\k<tab>\}\r?\n\k<tab>catch\s+.*\r?\n\k<tab>\{\s*\r?\n(?'caught'(.*\r?\n)+)\k<tab>\}(\r?\n)+
Replace with:
${tried}
Notables:
Practices:
NewerOlder