Is there anything in c# like using an external file or an include
file to store some of your functions? It's getting really hard to
find your way around when you have so many functions in your
main file.
Thanks
Nicholas Paldino [.NET/C# MVP] - 03 Jan 2008 18:52 GMT
Rob,
No, there isn't. You should create a separate assembly and expose the
functions as members on types and then access those in other assemblies
where you want to use the functionality.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> Is there anything in c# like using an external file or an include
> file to store some of your functions? It's getting really hard to
> find your way around when you have so many functions in your
> main file.
>
> Thanks
Family Tree Mike - 03 Jan 2008 18:53 GMT
There are no header or include statements as in C/C++. You can and should
separate your classes into separate files. It sounds like you are asking
something different though.
> Is there anything in c# like using an external file or an include
> file to store some of your functions? It's getting really hard to
> find your way around when you have so many functions in your
> main file.
>
> Thanks
Ignacio Machin ( .NET/ C# MVP ) - 03 Jan 2008 18:56 GMT
Hi,
Create a library project in your solution, you will end with a .dll that you
can use in as many projects as you want.

Signature
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
> Is there anything in c# like using an external file or an include
> file to store some of your functions? It's getting really hard to
> find your way around when you have so many functions in your
> main file.
>
> Thanks
Chris Shepherd - 03 Jan 2008 19:05 GMT
> Is there anything in c# like using an external file or an include
> file to store some of your functions? It's getting really hard to
> find your way around when you have so many functions in your
> main file.
There are many Visual Studio features designed to help you navigate your code.
For instance, in your code window, you have quick access to members of your
class via a dropdown. There's also the Class View which allows you to see
classes in your current solution broken down by project, namespace, class, and
then view the methods and properties in those classes, etc...
Chris.
TheMadHatter - 03 Jan 2008 20:04 GMT
Adding to Chris Shepherd's comment,
I tend to use a lot of the regions in my code for organization:
eg:
#region My Private Functions
private void MyfirstPrivateFctn()
{
}
#endregion
It realy helps clean up the code and make it managable.
Class diagrams also go a LONG way to readable code.
Hope this helps, good luck.
> Is there anything in c# like using an external file or an include
> file to store some of your functions? It's getting really hard to
> find your way around when you have so many functions in your
> main file.
>
> Thanks
Marc Gravell - 03 Jan 2008 21:31 GMT
Another option (may good already mentioned) is that if you find a
single class file is *still* overweight despite #regions etc, you can
use (in 2.0 and above) partial classes to split the single class into
multiple files (grouping related functionality). I find this
especially useful if I am implementing non-trivial interfaces etc - I
can have a MyClass.cs and a MyClass.ITrickyInterface.cs file, with all
the ITrickyInterface junk in the second file.
Marc
Marc Gravell - 03 Jan 2008 21:32 GMT
may good=>many good
stupid fingers!
Marc
Rob Stevens - 03 Jan 2008 22:35 GMT
Thanks averyone for the responses, I definitely know what I need
to do now.
Rob