Stacie
asked on
IsRequiredDateSold = requiredFields[9] == 'T', What does the 9 really mean. Index Value?
I have the following method below and I'm having a hard time understanding what does the following notation mean... The following code is reading from a table and converting it to a variable just not sure why the 9?
requiredFields[9] == 'T', why a 9?
requiredFields[9] == 'T', why a 9?
public static GeneralSetupProgramJobParameter GetProgramJobParameters(
GeneralSetupProgramJobParameter item,
string reqdfields,
string prodparam,
string chngparam,
string estutilfld,
bool defaultStatus0For2ndPrgm
)
{
var requiredFields = reqdfields.ToCharArray();
var productionDefaults = prodparam.ToCharArray();
var changeParams = chngparam.ToCharArray();
var estUtilFields = estutilfld.ToCharArray();
item.DefaultToStatus0For2ndProgram = defaultStatus0For2ndPrgm;
item.ProgramJobRequiredFields = new ProgramJobRequiredFields
{
IsRequiredDateSold = requiredFields[9] == 'T',
IsRequiredSalesPerson = requiredFields[11] == 'T',
IsRequiredSource = requiredFields[10] == 'T',
IsRequiredSize = requiredFields[16] == 'T',
IsRequiredRoute = requiredFields[14] == 'T',
IsRequiredCancelDate = requiredFields[12] == 'T',
IsRequiredCancelReason = requiredFields[13] == 'T',
IsRequiredRejectReason = requiredFields[15] == 'T',
IsRequiredEstimatedBy = requiredFields[26] == 'T',
};
item.ProductionDefaults = new ProductionDefaults
{
ProductAmounts = productionDefaults[0] == 'T',
StartTime = productionDefaults[1] == 'T',
EndTime = productionDefaults[2] == 'T',
WindSpeedAndDirection = productionDefaults[4] == 'T',
Temperature = productionDefaults[5] == 'T',
pH = productionDefaults[6] == 'T',
ConditionCodes = productionDefaults[8] == 'T',
Rating = productionDefaults[9] == 'T',
SaveAssociatedConditions = productionDefaults[7] == 'T',
Size = productionDefaults[10] == 'T',
Price = productionDefaults[11] == 'T',
};
Your function recieves a string called reqdfields. That gets split into a character array and stored in a variable called requiredFields.
This line:
IsRequiredDateSold = requiredFields[9] == 'T'
sets the IsRequiredDateSold variable to either true or false, by checking whether the 10th item in the requiredFields variable is equal to the letter T.
This line:
IsRequiredDateSold = requiredFields[9] == 'T'
sets the IsRequiredDateSold variable to either true or false, by checking whether the 10th item in the requiredFields variable is equal to the letter T.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER