"Balamurali C" <(E-Mail Removed)> wrote in message
news

230CCD2-5282-494F-9DF4-(E-Mail Removed)...
> if VB.NET does't support VarArgs then how come
> Console.Write("Test{0}{1}..",3,4) is works?
There are lots of overloads of Write: one takes one object, another takes
two and another three (other than the format string). Take a look at an
example of this call in ILDASM, C# and VB.NET call this method:
call void [mscorlib]System.Console::Write(string, object, object)
now try this:
Console.Write("Test{0}{1}{2}{3}",3,4,5,6)
If you look at ILDASM you'll see that the following method is called:
call void [mscorlib]System.Console::Write(string, object[])
The compile creates an array of the parameters to Write before calling the
method.
If you try to call this same line in managed C++ you'll see that it calls:
call vararg void [mscorlib]System.Console::Write(string, object, object,
object, object)
In other words, only C++ calls vararg methods, and C++ can only call them,
it cannot write them. To write a vararg method you have to use ILASM.
Richard
--
My email address
(E-Mail Removed) is encrypted with ROT13 (see
www.rot13.com)