473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using an external file for funtions

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
Jan 3 '08 #1
8 1522
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rob Stevens" <ro**********@sundry.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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


Jan 3 '08 #2
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.

"Rob Stevens" wrote:
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
Jan 3 '08 #3
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.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Rob Stevens" <ro**********@sundry.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
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


Jan 3 '08 #4
Rob Stevens wrote:
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.
Jan 3 '08 #5
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.

"Rob Stevens" wrote:
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
Jan 3 '08 #6
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
Jan 3 '08 #7
may good=>many good
stupid fingers!

Marc
Jan 3 '08 #8
Thanks averyone for the responses, I definitely know what I need
to do now.

Rob
Jan 3 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
12
by: Charles Law | last post by:
This is a bit of a vague question, but I am just starting on this, and wonder if anyone has ideas of where to start. I have a program that controls some external equipment. It sends messages in...
0
by: XSD-optimist | last post by:
I am trying to generate the classes for an XSD schema using the Microsoft XSD Object Code Generator (XSDObjGen). I am having a schema that contains the definition of the following: 1. a complex...
2
by: Mary | last post by:
Hello, I am having a problem with the cl compiler. I have written a C class (RegConnect.c) which uses Win32 API functions such as RegOpenKey, RegCloseKey etc. Initially when I was trying to...
2
by: praveenkojha | last post by:
Hi, I am novice in C++ and am more of a C# guy. I have a third party C++ code which I want to create and use as a managed assembly. I have created a .NET win32 application and have copied this...
0
by: Matthew | last post by:
I have created two configurations. One is called Release-Internal and one is called Release-External. I also have two config files named Internal.config and External.config. The difference in the...
5
by: TC | last post by:
I just noticed that the Stream class has a Seek method, which implies that a FileStream object can be used to manipulate a random-access file. Before now, I assumed that a Stream, as its name...
8
by: Bruce | last post by:
I am using VB in Vs2005. Am I missing something or does VB not have the concept of "builds" (release/debug) like in VC? I wrote an assembly and I would like to have a debug version of the DLL...
0
debasisdas
by: debasisdas | last post by:
This thread contains some useful tips for using External tables. USING EXTERNAL TABLE ======================= 1.THE TABLE POINTS TO EXTERNAL FILE. IF DATA IS ALTERED IN THE EXTERNAL FILE,DATA...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.