An example can explain a lot. This is the Mid source code from Microsoft.VisualBasic
public static string Mid(string str, int Start, int Length)
{
if (Start <= 0)
{
throw new ArgumentException(Utils.GetResourceString("Argument_GTZero1", new string[] { "Start" }));
}
if (Length < 0)
{
throw new ArgumentException(Utils.GetResourceString("Argument_GEZero1", new string[] { "Length" }));
}
if ((Length == 0) || (str == null))
{
return "";
}
int length = str.Length;
if (Start > length)
{
return "";
}
if ((Start + Length) > length)
{
return str.Substring(Start - 1);
}
return str.Substring(Start - 1, Length);
}
At the end of the day, they call Substring ....
The story is a bit more complicated for Instr
agains IndexOf
, because you can use the comparison parameter, but in this case the internal code used in the Microsoft library. VisualBasic COMPATIBILITY (Bold is my) falls again inside the basic methods provided .NET Framework
, , VB6, . , , NET Framework.