C# class type - How to determine whether it is a standard .net framework class?

Read the Assembly Company Attribute from the assembly assembly: AssemblyCompany("Microsoft Corporation") msdn.microsoft.com/en-us/library/y1375e3... using System; using System. Reflection; assembly: AssemblyTitle("CustAttrs1CS") assembly: AssemblyDescription("GetCustomAttributes() Demo") assembly: AssemblyCompany("Microsoft") namespace CustAttrs1CS { class DemoClass { static void Main(string args) { Type clsType = typeof(DemoClass); // Get the Assembly type to access its metadata. Assembly assy = clsType.

Assembly; // Iterate through the attributes for the assembly. Foreach(Attribute attr in Attribute. GetCustomAttributes(assy)) { // Check for the AssemblyTitle attribute.

If (attr.GetType() == typeof(AssemblyTitleAttribute)) Console. WriteLine("Assembly title is \"{0}\". ", ((AssemblyTitleAttribute)attr).

Title); // Check for the AssemblyDescription attribute. Else if (attr.GetType() == typeof(AssemblyDescriptionAttribute)) Console. WriteLine("Assembly description is \"{0}\".", ((AssemblyDescriptionAttribute)attr).

Description); // Check for the AssemblyCompany attribute. Else if (attr.GetType() == typeof(AssemblyCompanyAttribute)) Console. WriteLine("Assembly company is {0}.

", ((AssemblyCompanyAttribute)attr). Company); } } } }.

Thanks, I have used a combination of 1. ) The "Company Attribute" and 2. ) "Strongname / token" answer to solve my issues.

I appreciate your feedback. – HorstWalter May 6 '10 at 12:12 This don't means that is . NET Standart class.

Many classes come with . NET but not is Standart. And other .

NET implementation like Mono have another Company Name – Fujiy May 6 '10 at 12:17 Yes, you are right. "Standard" meant something specific in my very application context, however the "company attribute" / "token answer" helped to improve my detection method. Academically my definition is not precise / ambiguous.

– HorstWalter May 6 '10 at 12:43.

You could check the assembly's public key token. Microsoft (BCL) assemblies will have the public key token b77a5c561934e089 or b03f5f7f11d50a3a. WPF assemblies will have the public key token 31bf3856ad364e35.In general, to get the public key token of an assembly, you can use sn.

Exe-Tp foo.dll. Sn. Exe is part of the Windows SDK, which you should already have.

You can get the public key token from the assembly's full name (e.g. Typeof(string).Assembly. FullName), which is just a string, or you can get the raw public key token bytes from the assembly by doing a P/Invoke into StrongNameTokenFromAssembly.

Thanks, I have used a combination of 1. ) The "Company Attribute" and 2. ) "Strongname / token" answer to solve my issues.

I appreciate your feedback. – HorstWalter May 6 '10 at 12:02.

A couple of ideas: in Visual Studio, within Solution Explorer, expand References, right click a reference, then choose Properties and look at the path, example: C:\WINDOWS\Microsoft. NET\Framework\v2.0.50727\System. Dll I'm guessing that most assemblies in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ are likely to be standard .NET.

Also, you could look up the assembly in MSDN library, example: http://msdn.microsoft.com/en-us/library/system.aspx. Regards ~~ gerry (lowry).

You can consult here: en.wikipedia.org/wiki/Base_Class_Library.

You could check the assembly's public key token. Microsoft (BCL) assemblies will have the public key token b77a5c561934e089 or b03f5f7f11d50a3a. WPF assemblies will have the public key token 31bf3856ad364e35.

In general, to get the public key token of an assembly, you can use sn. Exe is part of the Windows SDK, which you should already have. You can get the public key token from the assembly's full name (e.g. typeof(string).Assembly.

FullName), which is just a string, or you can get the raw public key token bytes from the assembly by doing a P/Invoke into StrongNameTokenFromAssembly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions