Retrieve only custom columns for a document library?

When I retrieve fields from an SPFieldCollection object using this code:

SPFieldCollection fields = documentLibrary.Fields;
foreach (SPField field in fields)
{
//do something
}

I get a lot of fields which are default for every document library. What I would like to do is retrieve only the fields or columns that I have defined and not the rest. Is there any way to do this using the WSS object model. Thanks in advance.

[448 byte] By [JohnDorian] at [2008-1-2]
# 1
Soooo, anyone?
JohnDorian at 2007-9-13 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...
# 2
I'm not sure if there's a way to do this out of the box.

My approach was to put all my custom fields into groups whose name begins myCompany_... this way I can easily determine which fields are mine.


SPFieldCollection fields = documentLibrary.Fields;
foreach (SPField field in fields)
{
if field.Group.Conatins("myCompany_")
{
//do something
}
}

NickCox at 2007-9-13 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Development and Programming...

SharePoint Products and Technologies

Site Classified