Skip to content

Instantly share code, notes, and snippets.

View VBAndCs's full-sized avatar

Mohammad Hamdy Ghanem VBAndCs

View GitHub Profile
@VBAndCs
VBAndCs / Joiner.md
Last active January 31, 2022 01:12
Using interpolated string handlers in VB.NET

Usage

        Dim Ali As Object = "Ali"
        Dim age = 16
        Dim x As String = "Students: ".CrLf.
            str("Name: ").arg(Ali, -5).
            str(", Age: ").arg(age, 7, "N2").CrLf.
            str("Name: ").arg("Yaser").
            str(", Age: ").arg(20, 7, "N2")
@VBAndCs
VBAndCs / Interpolated-Parseing.md
Last active January 31, 2022 01:12
Safe/Managed Interpolated Parseing
using System.Runtime.CompilerServices;

string input = "My Name: Andrew Smith  ; Age: 31 years; City: London.";

Placeholder<string> name = new();
Placeholder<int> age = new();
Placeholder<string> city = new();

input.TryParse($"Name: {name} Age: {age} City: {city}");