We help IT Professionals succeed at work.

IsRequiredDateSold = requiredFields[9] == 'T', What does the 9 really mean. Index Value?

Stacie
Stacie asked
on
115 Views
Last Modified: 2018-09-19
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?

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',
                };

Open in new window

Comment
Watch Question

Author

Commented:
Is it something that was auto generated by VS?
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019

Commented:
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.
Chief Technology Ninja
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions