The same code gets executed when you call Type.GetConstructors() regardless
of which language you call it with, since the Type class is implemented in
C#. The difference you are seeing is probably related to the difference in
how the J# compiler stores information about classes. It is not a good
idea to make any assumptions in code about the order in which the
constructors will be returned as it might be changed in later versions of
the .Net framework.
I hope this is helpful,
Michael Green
Microsoft Developer Support
--------------------
| Thread-Topic: GetConstructors() function
| thread-index: AcQSLHddgo8rx00VQtyFOMQiR7yixg==
[quoted text clipped - 20 lines]
|
| hello,
Can any one please tell me the order in which
GetConstructors(BindingFlags) function returns the constructors? This is
because in C# the function takes the constructors in the order in which
they are defined but in J# it always takes static construtors at last.
This resulted in change in output of J# as compared to C#.
The actual code is.
// <Snippet2>
import System .* ;
import System.Reflection .* ;
public class t
{
public t()
{
} //t
static
{
} //t
public t(int i)
{
} //t
public static void main(String[] args)
{
ConstructorInfo p[] = t .class.ToType().GetConstructors(
(BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic
| BindingFlags.Instance));
Console.WriteLine(p.length);
for(int i=0;i< p.length;i++){
Console.WriteLine(p[i].get_IsStatic());
}
} //main
} //t
// </Snippet2>
Thanks.