Tag Archives: Extension Methods

C# String Token Replacer

Imagine this classic text where you need to replace tokens with some values: Welcome {{user}}. Click on this link to confirm your subscription: {{url}}. Tokens encapsulated in double brackets {{token}} are commonly used to mark tokens to be replaced with … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , | Leave a comment

XElement get default values using extension methods

I often work with dynamic XML documents which might or might not contain the element, field or attribute that I am looking for. The Standard .NET XElement class is pretty strict (as it should be) and returns a null reference … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , | 1 Comment

Simple string keyword search using ExtensionMethods and LINQ

This is a case I ran into recently. I need to create a multiple OR condition with LINQ. I have a list of user names and I wish to create a simple search where I can match any first name/middle … Continue reading

Posted in .net, c#, General .NET | Tagged , , | 1 Comment