views:

97

answers:

4

If you take a look at http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/activedirectoryoperations11132009113015AM/activedirectoryoperations.aspx, there is a huge list of properties for AD in one class.

What is a good way to refactor such a large list of (Related) fields? Would making seperate classes be adequate or is there a better way to make this more manageable?

Thanks

A: 

If you're talking about dividing them into logical groups, then classes would work fine for this, and it might make them easier to navigate. I'm sure there's a reason that the properties in AD aren't grouped together in this way, but I always try to group things together when I get so many properties that I have to start some serious scrolling.

rwmnau
+1  A: 

If they are related, they should belong together...

If you think you can group them further (i.e. address, phone numbers), you can create simple classes for those.

Oded
A: 

The first batch I'd extract are the eight that start with "MSEXCH" - that prefix indicates that the author felt there was something common about those properties. Beyond that, I don't see much that naturally falls into easy groups, but if you find certain properties always being used together, putting them into the same class would probably be a good idea.

Carl Manaster
A: 

if the issue is with the source code being too long you can your Automatic properties

    public string Department { get; private set; }
    public string FirstName { get; private set; }
    public string MiddleName { get; private set; }
    public string LastName { get; private set; }
    public string LoginName { get; private set; }
    public string LoginNameWithDomain { get; private set; }
    public string StreetAddress { get; private set; }
    public string City { get; private set; }
    public string State { get; private set; }
    public string PostalCode { get; private set; }
    public string Country { get; private set; }
    public string HomePhone { get; private set; }
    public string Extension { get; private set; }
    public string Mobile { get; private set; }
    public string Fax { get; private set; }
    public string EmailAddress { get; private set; }
    public string Title { get; private set; }
    public string Company { get; private set; }
Keivan