How do i build my own code 'library' (not .dll!)

  • Thread starter Thread starter garyusenet
  • Start date Start date
G

garyusenet

Hi,

As I continue to explore C# , Visual Studio, and Programming in general
I am becoming increasingly hooked. I see myself definately studying and
learning c# with visual studio over the next year or two and am
frequently finding pieces of code i'd like to save for later use.

Is there a better way than just saving the code files in a folder with
a description of what each does?

Does visual studio have a way of building a code 'library' that I can
store all these pieces of code in for later use, and just search
through it and things like that?

Many thanks and apologies if this is a wacky question,

Gary.
 
Is there a better way than just saving the code files in a folder with
a description of what each does?

What I've settled upon is this: (1) I keep all my completed projects
on the hard disk in a directory c:\comp, and from Visual Studio I use
Search>FindInFiles to scan every single one of them for any keywords.

But much more usefully, (2) When I've learnt something, I write it up
as a tutorial or example program. I've submitted some tutorials to
codeproject.com. More recently I've stored them on my own website in
wiki format. That's because other people *will* read them, use them,
find bugs, and submit bugfixes. Previously they'd email me the
bugfixes, or send them as comments to codeproject, but I was always
too busy to change anything. I'm hoping that now in wiki format it'll
be easier for me (and others) to make changes.

An important discipline for this: *ALWAYS* include a complete
compilable example program for download, so people can download it and
compile it and see if it really does work. Otherwise you'll get
frequent emails from people who don't understand the Visual Studio
project system. Also, a screenshot helps a lot.

I've found it useful to include the complete source code of my
programs on the web-pages themselves. That way, you can google-search
for particular library function-names and find them.

http://www.wischik.com/lu/Programmer


The reason for all of this is that unmaintained code will inevitably
die. Just saving your code snippets in a folder, you'll forget what
they did, they'll stop working in newer compilers, they'll get out of
date, and your archive will lose its value.

The other reason for doing this is that, by and large, I've learnt an
enormous amount from other people in newsgroups and websites. This is
my way of giving back to the community.
 
Thank you that sounds like a good plan!
Lucian said:
What I've settled upon is this: (1) I keep all my completed projects
on the hard disk in a directory c:\comp, and from Visual Studio I use
Search>FindInFiles to scan every single one of them for any keywords.

But much more usefully, (2) When I've learnt something, I write it up
as a tutorial or example program. I've submitted some tutorials to
codeproject.com. More recently I've stored them on my own website in
wiki format. That's because other people *will* read them, use them,
find bugs, and submit bugfixes. Previously they'd email me the
bugfixes, or send them as comments to codeproject, but I was always
too busy to change anything. I'm hoping that now in wiki format it'll
be easier for me (and others) to make changes.

An important discipline for this: *ALWAYS* include a complete
compilable example program for download, so people can download it and
compile it and see if it really does work. Otherwise you'll get
frequent emails from people who don't understand the Visual Studio
project system. Also, a screenshot helps a lot.

I've found it useful to include the complete source code of my
programs on the web-pages themselves. That way, you can google-search
for particular library function-names and find them.

http://www.wischik.com/lu/Programmer


The reason for all of this is that unmaintained code will inevitably
die. Just saving your code snippets in a folder, you'll forget what
they did, they'll stop working in newer compilers, they'll get out of
date, and your archive will lose its value.

The other reason for doing this is that, by and large, I've learnt an
enormous amount from other people in newsgroups and websites. This is
my way of giving back to the community.
 
I have created a 'class library' project, called 'My Library'. The
first file that is automatically created for me is called 'Class1.cs'.
In this file I have renamed the namespace to GaryLibrary like so
(following) and I have created a class called ArrayLists: -

using System;
using System.Collections.Generic;
using System.Text;

namespace GaryLibrary
{
public class ArrayLists
{

}
}


So I guess now I will just write my array list examples in this class.
One thing I have learnt recently is how to copy the contents of an
arraylist to a listview, so I will code a method called ' .tolistview '

Question: Mark said I should break up different namespaces with
corresponding folders, I don't understand this? How do i do this and
what does it mean?

Question2: Should I code all my examples in this one file just creating
a different class for each topic? for instance I have a class
ArrayLists at the moment. Next I would create a class InternetExplorer
etc... to store examples i've learnt recently of interfacing with
internet explorer.

Question3: Generate documentation automatically using the XML feauture.
Can someone explain what this is and how I do it please.

Many Thanks,

Gary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top