Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
hey guys,

i am working on a project and i need a list of every c# reference. an example would be System, System.Linq, System.Text, etc. i need the full list of them. don't ask questions...

thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 19-May-13 0:51am    
Please explain what do you mean by "don't ask question".

I actually did not want to ask you a question, but this clause made me interested. So, please explain.

—SA
Member 8378691 19-May-13 2:15am    
but 'don't ask questions', I mean don't ask why I'm trying to find out all of the references...
Sergey Alexandrovich Kryukov 19-May-13 2:43am    
OK, now please explain why are you trying to do so, don't be so enormously arrogant. Note that I answered your question without asking, by generally — who want to waste time on answering without knowing the purpose? What if it makes no sense? We donate our time and have every right to know if it is wasted (which happens way too often anyway), or not.
—SA
Member 8378691 19-May-13 2:56am    
My friend asked me if I could teach him how to program because he wants to know, but he doesn't know where to begin. So I'm making a small interpreter that takes in code, changes it to C# code and I'm using a CSharpCodeProvider class to compile the code into a .exe file. So I've changed it a little, but I still want to make it easier for him by taking out the 'using System;' and all that...
Sergey Alexandrovich Kryukov 19-May-13 3:04am    
Thank you for sharing.
—SA

There is no such thing as "C# reference". A "a programming language writer" like you should be able to understand such basic things.

I assume you mean how to figure out, given an assembly, which assemblies it references. From the other hand, it could be the set of actually loaded assemblies.

This is how to get referenced assemblies: http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getreferencedassemblies.aspx[^].

This is another method giving somewhat different results, getting loaded assemblies: http://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies.aspx[^].

With second method, you can take all Application Domains during runtime of your process and merge loaded assemblies.

So, why these two methods give different results? The thing is: when you load assemblies, you can reference more of them then you actually need. It looks like actually unused referenced assemblies are optimized out by the CLR: if you use the second method, you may find that some of your assemblies are not actually used. Another reason is this: you can load assembly during runtime, using one of corresponding methods of System.Reflection.Assembly. From this moment, some new assembly will appear as loaded in the Application Domain where you did it, but such assembly does not have to be referenced.

[EDIT]

Also, you question suggests that you confuse assemblies and namespaces. For example, "System" cannot be "referenced", because this is not an assembly. If you take just .NET FCL assemblies, you will see that two different assemblies declare types under then namespace "System". Moreover, you can create your own assembly and declare types under the same namespace, and it will be perfectly valid, some 3rd-party products are like that. And one assembly can declare types under two or more different (related or unrelated) namespaces.

Those things are just orthogonal to each other. In fact, namespaces do not exist as any actual objects when the code is compiled to CIL. They are no more but some subsets of fully-qualified type names. The type and the assemblies declaring them, as well as modules — this is what actually exist. And only assemblies can be referenced, not namespaces.

You just need to read about those concepts, before you can move forward.

—SA
 
Share this answer
 
v2
First, open your studio. Then right click on the references folder and select "Add Reference...". Select the .NET tab, then write down everything that you see that's installed in the GAC.
 
Share this answer
 
Comments
Member 8378691 19-May-13 0:59am    
I know how to do that, but I really don't want to write down EVERYTHING. I was just wondering if someone already has done it and could just give it to me or if someone knows a link...
Sergey Alexandrovich Kryukov 19-May-13 1:03am    
Makes no sense. Everything where? In the GAC of some certain computer? In whole system? It depends. You should understand that as soon as you develop yet another assembly, the number of assemblies in the world grows...
—SA
You don't actually mean C# references, you mean .NET references[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900