-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Sitaraman
Message 10 in Discussion
Hi Rajesh Glad tht i could help. One more home-made recipe for verifying it(actually
i had started coding it before ur reply, so thought i might as well post it rather
than junking it ;) ) The following code will print the exact access modifiers for
the constructors of SQLDataReader and DataSet . Guess i should have coded this and
posted it first instead of the complex ones before :) Imports
System.Data.SqlClient
Imports System.Reflection
Module Module1 Sub main()
GetInfo(GetType(SqlDataReader))
GetInfo(GetType(DataSet))
Console.ReadLine() End Sub Sub GetInfo(ByVal p_objType As Type)
Dim l_objMemberInfos() As System.Reflection.MemberInfo =
p_objType.GetMembers(BindingFlags.NonPublic Or BindingFlags.Public Or
BindingFlags.Static Or BindingFlags.Instance)
Dim l_objMemberInfo As System.Reflection.MemberInfo
Dim iConstructorCtr As Integer = 0
Console.WriteLine("Getting the Constructor Info for Type : " & p_objType.Name)
Console.WriteLine("----------------------------------------------------------")
For Each l_objMemberInfo In l_objMemberInfos
If l_objMemberInfo.GetType.ToString =
"System.Reflection.RuntimeConstructorInfo" Then
iConstructorCtr = iConstructorCtr + 1
Console.WriteLine("Runtime Constructor # : " & iConstructorCtr)
Console.WriteLine("Runtime Constructor Name : " & l_objMemberInfo.Name)
Console.WriteLine("Is Constructor a Friend : " &
CType(l_objMemberInfo, Object).IsAssembly())
Console.WriteLine("Is Constructor a Private : " &
CType(l_objMemberInfo, Object).IsPrivate())
Console.WriteLine("Is Constructor a Protected : " &
CType(l_objMemberInfo, Object).IsFamily())
Console.WriteLine("Is Constructor a Public : " &
CType(l_objMemberInfo, Object).IsPublic())
Console.WriteLine("")
Console.WriteLine("")
End If
Next
End Sub End Module The output of the code is Getting the
Constructor Info for Type : SqlDataReader
----------------------------------------------------------
Runtime Constructor # : 1
Runtime Constructor Name : .ctor
Is Constructor a Friend : True
Is Constructor a Private : False
Is Constructor a Protected : False
Is Constructor a Public : False
Getting the Constructor Info for Type : DataSet
----------------------------------------------------------
Runtime Constructor # : 1
Runtime Constructor Name : .ctor
Is Constructor a Friend : False
Is Constructor a Private : False
Is Constructor a Protected : False
Is Constructor a Public : True
Runtime Constructor # : 2
Runtime Constructor Name : .ctor
Is Constructor a Friend : False
Is Constructor a Private : False
Is Constructor a Protected : False
Is Constructor a Public : True
Runtime Constructor # : 3
Runtime Constructor Name : .ctor
Is Constructor a Friend : False
Is Constructor a Private : False
Is Constructor a Protected : True
Is Constructor a Public : False
Runtime Constructor # : 4
Runtime Constructor Name : .cctor
Is Constructor a Friend : False
Is Constructor a Private : True
Is Constructor a Protected : False
Is Constructor a Public : False hth regards, sr
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]