-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: venkat_kl
Message 3 in Discussion
Hi, As far as I know, You can know the Details any Type perticularly in your
case, a class through Reflection. I am not very sure of CODEDOM whether any
feature is available!!( I Know that, The classes in this namespace can be used
to model the structure of a source code document that can be output as source
code in a supported language using the functionality provided by the
System.CodeDom.Compiler namespace) After reading you query message, i was
curious to work little bit on that. What I tried and What I got the output, I
have simply noted below. I imported the
Imports System.Reflection
I created two(2) interfaces namely, IInterface1 & IInterface2
and two (2) Classes namely, ClassA (child class) & ClassA_Parent (parent class)
Parent Class - ClassA_Perent Implements interface - IInterface1 &
Child Class - ClassA Implements interface - IInterface2 and also inherits the
class ClassA_Parent
and finally in the Button Click Event, just created an instance of a child
class ClassA and Called the GetClassDetails passing the ClassA object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim c As New ClassA
GetClassDetails(c)
End Sub
-------------------------------------------------------------------------------------
Public Sub GetClassDetails(ByVal c As Object)
Dim t As Type = c.GetType
Dim ObjectMembers As MemberInfo() = t.GetMembers
Dim Iterator As MemberInfo
Dim i As Integer = 1
For Each Iterator In ObjectMembers
If i = 1 Then
Debug.WriteLine(Iterator.ReflectedType.ToString)
End If
Debug.WriteLine(Iterator.Name)
i = 2
Next
End Sub
-------------------------------------------------------------------------------------
I got the all the members of
Base ClassA,
Parent Class ClassA_Parent,
IInterface1,
IInterface2 like below
only OUTPUT
'Interface2_MyFunc
'Interface1_MyFunc
'GetHashCode
'Equals
'ToString
'Child_ClassA_Own_Function
'get_Child_ClassA_Age
'set_Child_ClassA_Age
'get_ClassA_Parent_Name
'set_ClassA_Parent_Name
'GetType
'.ctor
'Child_ClassA_Age
'ClassA_Parent_Name
OUTPUT - with Details
'Interface2_MyFunc - Interface 2 Function
'Interface1_MyFunc - Interface 1 Function
'GetHashCode - Object Class
'Equals - Object Class
'ToString - Object Class
'Child_ClassA_Own_Function - Child Class ClassA
'get_Child_ClassA_Age - Child Class ClassA's Child_ClassA_Age Property's
Get Method
'set_Child_ClassA_Age - Child Class ClassA's Child_ClassA_Age Property's
Set Method
'get_ClassA_Parent_Name - Parent Class ClassA_Parent's ClassA_Parent_Name
Property's Get Method
'set_ClassA_Parent_Name - Parent Class ClassA_Parent's ClassA_Parent_Name
Property's Set Method
'GetType - Object Class
'.ctor --???(do not know)
'Child_ClassA_Age - Child Class ClassA's Property 'Child_ClassA_Age
'ClassA_Parent_Name - Parent Class ClassA_Parent's Property
ClassA_Parent_Name
-------------------------------------------------------------------------------------
Structures of all the Classes and Interface(s) are like below Public
Interface IInterface1 Function Interface1_MyFunc(ByVal MyInt As Integer) As
Integer
End Interface
-------------------------------------------------------------------------------------
Public Class ClassA_Parent
Implements IInterface1 Private _ClassA_Parent_Name
Public Property ClassA_Parent_Name()
Get
Return _ClassA_Parent_Name
End Get
Set(ByVal Value)
_ClassA_Parent_Name = Value
End Set
End Property Public Function Interface1_MyFunc(ByVal MyInt As
Integer) As Integer Implements IInterface1.Interface1_MyFunc
Return 45
End Function End Class
-------------------------------------------------------------------------------------
Public Interface IInterface2 Function Interface2_MyFunc(ByVal MyStr As
String) As String
End Interface
-------------------------------------------------------------------------------------
Public Class ClassA
Inherits ClassA_Parent
Implements IInterface2 Private _mChild_ClassA_Age As String
Public Function Child_ClassA_Own_Function(ByVal a As Integer) As Integer
Return 1
End Function
Public Property Child_ClassA_Age()
Get
Return _mChild_ClassA_Age
End Get
Set(ByVal Value)
_mChild_ClassA_Age = Value
End Set
End Property
Public Function Interface2_MyFunc(ByVal MyStr As String) As String
Implements IInterface2.Interface2_MyFunc
Return System.Windows.Forms.MessageBox.Show("Hi - from
IInterface2.Interface2_MyFunc - Implemented in Child Class A")
End Function End Class
-------------------------------------------------------------------------------------
bye venkat_kl
-----------------------------------------------------------
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]