Is it possible to export the user controls properties from my VB project to a text file or to excel. I have tried google ,but today google isn't my friend. I 开发者_StackOverflowam using VB 2010 express
thanks
I think you are looking for something like this:
Const path = "C:\Test.txt"
Dim query = From assembly In My.Application.Info.LoadedAssemblies
From type In assembly.GetTypes
Where type.IsSubclassOf(GetType(UserControl))
From prop In type.GetProperties
Select PropInfo = String.Format("{0}{3}{1}{3}{2}",
assembly.GetName().Name,
type.Name,
prop.Name,
vbTab)
If query.Any Then
IO.File.WriteAllLines(path, query)
End If
Modify the LINQ query to your exact requirement. For example if you only want public properties with set-accessor that is writable:
Where prop.CanWrite AndAlso Not prop.GetSetMethod Is Nothing AndAlso prop.GetSetMethod.IsPublic
精彩评论