Hi All,
My basic purpose is to create some sort of documentation for a very big assembly which has a lot of classes and a lot of methods within it.
I am having an issue relating to extracting Parameter Type info. I have as assembly and this assembly references several other custom assemblies. These custom assemblies are created by me and are within the same directory
I load the assesmbly and extract all the exported types and then methods. When I try to extract the parameters info on the MethodInfo object by calling GetParameters method I get "FileNotFoundException" for one of the referenced assemby.
Also, I want to extract only methods which are - -- Public/Non-Public methods declared withing the class and do not want Property and Event methods (i.e. get_XX, set_XXX, add_XXx, and remove_XX)
which I am unable to achieve
Any sort of help, highly appreciated
Thanks in advance
Regards, Girish Jain
Here's is the code:-
p_Asmbly = [Assembly].LoadFile(txtAssemblyPath.Text)
Dim p_Type As Type Dim p_Types() As Type p_Types = p_Asmbly.GetExportedTypes()
Dim p_Method As MethodInfo Dim p_Methods() As MethodInfo
Dim p_Param As ParameterInfo Dim p_Params() As ParameterInfo
Dim strParams As String = String.Empty
For Each p_Type In p_Types p_Methods = p_Type.GetMethods()
p_Type.GetMethods(BindingFlags.Public And BindingFlags.Instance And BindingFlags.DeclaredOnly)
rtbOutput.Text += "Type Name : " & p_Type.Name & vbCrLf rtbOutput.Text += "--------------------------------------------------" & vbCrLf objCSVWriter.WriteLine("Type Name : " & p_Type.Name)
For Each p_Method In p_Methods
If Not (p_Method.Name.Substring(0, 4) = "get_" Or p_Method.Name.Substring(0, 4) = "set_") Then
' Get the paremeter details for the method p_Params = p_Method.GetParameters '******************Exception!!!!!
For Each p_Param In p_Params strParams += p_Param.Name & " As " & p_Param.ParameterType.ToString & ", " Next p_Params = Nothing If strParams.Length > 0 Then strParams = strParams.Substring(0, strParams.Length - 2)
rtbOutput.Text += p_Method.Name & "(" & strParams & ")" & vbCrLf objCSVWriter.WriteLine(p_Method.Name)
strParams = String.Empty End If Next
rtbOutput.Text += "--------------------------------------------------" & vbCrLf & vbCrLf objCSVWriter.WriteLine() objCSVWriter.WriteLine() Next
objCSVWriter.Close()
_________________________________________________________________ Cool ringtones, snazzy logos! Funny cards, addictive games! http://www.msn.co.in/Mobile/ Get them all at one place!
=================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in:
Essential .NET: building applications and components with C# November 29 - December 3, in Los Angeles http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com