Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get list of the classes in casual assembly
Message
From
16/03/2010 09:24:41
 
 
To
16/03/2010 08:56:38
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01453908
Message ID:
01454756
Views:
33
Vlad,

Can you post the your code between < pre > and < /pre> tags like in message#1454141

Also, does this method work ?
		static void Main()
		{

			string assemblyName = "BaseTest";
			assemblyName = "System.Windows.Forms";

			
			var list = GetModInfo(assemblyName);

			foreach (var className in list)
			{
				Console.WriteLine("{0} : {1}", className.IsClass ? "Class" : "Struct", className.FullName);
			}
			Console.ReadLine();

		}
		public static List<Type> GetModInfo(string assemblyName)
		{
			var list = (from m in Assembly.Load(assemblyName).GetModules() select m.GetTypes().Where(x => x.IsClass)).ToList();

			var theList = new List<Type>();
			foreach (var m in list)
				theList.AddRange(m);

			return theList;
		}



>Gregory
>Sorry for answer delay, I was out of job few days
>1 The problem, that string
>classList.AddRange(from x in module.GetTypes().Where(x => x.IsClass) select x);
>gives me error on '.where'
>The message system.array has no definition of where or some referenceor using is missing
>I have used for project NET 3.5
>I had referencies on Linq etc
>Intelesence also does not see- 'where' in module.GetTypes().Where, only equal
>Without 'from' variant the code works fine
>
>Other problem
>When I put my ready project dll on other computer,
>any referencies on any NET assymblies are not found. application trys to find it in working directory, instead of finding in net dll directory
>Old variant on 2005 studia with loadwithpathname(assembly) instead of Load works fine on other computer
>II mean, application try to find for example System.Windos.Forms.dll not in right place and sure does not find it
>All errors comes from Assembly.Load(assemblyName) does not matter whet is assembly name
>Other computer also has NEt 3.5 and all requied dll
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform