There is a third solution.
Write a wrapper object, containing all the parameters.
public class EmployeeController
public static void UpdateEmployee ( EmployeeArgs arg )
{
}
public class (or struct) EmployeeArgs
{
public Guid EmployeeUUID (property here)
public string LastName
public string FirstName
public DateTime CreateDate
public DateTIme HireDate
}
EmployeeArgs myArg = new EmployeeArgs ( ) ;
myArg.EmployeeUUID = Guid.NewGuid();
myArg.LastName = "Smith";
myArg.FirstName = "John";
myArg.CreateDate = DateTime.Now;
EmployeeController.UpdateEmployee ( myArg);
With 30 (and some optional) parameters, I'd write the wrapper arg object.
You'll notice I didnt' specify the HireDate, aka, it is optional. Your
controller class can determine what to do in an omitted HireDate.
ALSO.
If you have some MANDATORY properties, then you can expose the constructor
to the wrapper arg.
public class EmployeeArgs
{
//no default constructor
public EmployeeArg ( string lname, string fname)
{
this.LastName = lname;
this.FirstName = fname;
}
public Guid EmployeeUUID (property here)
public string LastName
public string FirstName
public DateTime CreateDate
public DateTIme HireDate
}
This way, you're forcing lname and fname.
"Larry Bud" <la**********@yahoo.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
I'm writing a class to create a specifically formatted fixed width
file. It's 800 characters wide, consisting of approx 30 fields.
So I need to pass 30 variables, maybe 10 are required. Should I write
the function to accept these as parameters in a method, or should I
make them properties? Can I make certain properties required?