473,320 Members | 1,979 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.

How do you create a library of commonly used structs, enumerationsconstants and functions using C#

Coming from a pure C/C++ background - recently started looking at C# for
a project. The absence of header files in C# has thrown me "a bit of a
curve".

I want to modularise my code and put all the commonly used data types
etc into a single compilation unit (library). How may I do this in C# -
any examples would be useful - tx
Feb 4 '07 #1
2 1519
Bit Byte <ro**@yourbox.comwrote:
Coming from a pure C/C++ background - recently started looking at C# for
a project. The absence of header files in C# has thrown me "a bit of a
curve".

I want to modularise my code and put all the commonly used data types
etc into a single compilation unit (library). How may I do this in C# -
any examples would be useful - tx
Just create a class library project, and then add a reference to it
from other projects.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 4 '07 #2
On Feb 4, 4:06 am, Bit Byte <r...@yourbox.comwrote:
Coming from a pure C/C++ background - recently started looking at C# for
a project. The absence of header files in C# has thrown me "a bit of a
curve".

I want to modularise my code and put all the commonly used data types
etc into a single compilation unit (library). How may I do this in C# -
any examples would be useful - tx
C# uses DLLs the way that C++ would use header files. The compiler
examines the contents of a DLL, part of which is a manifest that
contains definitions for all of the publicly available types,
including method call signatures.

So, just create a separate project for your common library, put all of
your common stuff in it, and build it into a DLL.

Then, when you want to use it in another project, just use Add
Reference in that project to add a reference to the DLL that you
created in the library project. Your client project will then "know
about" all of the public types in the library.

Feb 4 '07 #3

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

Similar topics

3
by: fabio de francesco | last post by:
Hello, I have a couple of years of experience with C++. I started studying C++ syntax, then I read the B.Stroustrup's book, and eventually I went through the N.Josuttis' book on how to program...
1
by: Myk Quayce | last post by:
I'm writing a website using Notepad and ASP.NET and C#, and I'm trying to determine the best way of grouping commonly-used methods so they can be accessed by many .aspx pages. Any help would be...
2
by: Joey | last post by:
Hey, I need to create a share on a remote folder using VB.NET, On the remote server, there is NO WMI, hence I need to find a way to do so, Without using WMI. Thanks ahead, --Joey
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
3
by: deepthisoft | last post by:
hai, I have 2 javascript funtions.I want to call these 2 functions using one button. my code is like this, <input type="button" value="ok" onclick="validate(this),change()">
5
by: Laszlo Nagy | last post by:
Hi, I want py2exe not to create library.zip. My reason is that the installed program will be a self updating program, and it must be able to download changes (newer python source files) from the...
3
tharden3
by: tharden3 | last post by:
What is the Progamming Language most commonly used to make big name games like COD4? Is it java? Would you use different ones for different types of games?
3
by: jduhler | last post by:
Is there a way in SQL Server T-SQL to store commonly used SQL statements in a function, stored proc, or system variable? That way if that code ever changes I can change it in one place. If I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.