A somewhat type-safe String.Format
Using String.Format you can format any string. However, the last parameter that String.Format accepts is of type object. So, to add some type-safety to the mix, the following function works perfectly.
VB.NET
Public Function
FormatString(
Of
T)(
ByVal
originalString
As String
,
ByVal
replacement
As
T)
As String
Return String
.Format(originalString, replacement)
End Function
C#
public string
FormatString(
string
originalString, T replacement)
{
return
String
.Format(originalString, replacement);
}