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.