If I have an array called standard and i want the count of that array i would do standard.Count
but
if i was to have a string array called doorType and i add the string standard to the first position of that array but i wanted to reference standard.Count is there a way i can manipulate doorType[0].Count so that it gets the number of elements in the standard array?
public static List<string> doorType = new List<string>
{
nameof(standard),
nameof(original)
};
public static List<string> standard= new List<string>
{
"1",
"4",
"6"
};
How can i make the second line equal?
string xform = doorType[0] + standard.Count;
string xform = doorType[0] + doorType[0].Count;
Some extra helpful code
public static void AddDropDown(string cellInsert, string formula)
{
var cell = x.Range[cellInsert];
cell.Validation.Delete();
cell.Validation.Add(
Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertInformation,
Excel.XlFormatConditionOperator.xlBetween,
formula,
Type.Missing);
cell.Validation.IgnoreBlank = true;
cell.Validation.InCellDropdown = true;
cell.Value = "Please Select";
}//end AddDropDown
string xform =
"=IF(B2=" + DO.quote + doorType[0] + DO.quote + "," + "E1:E" + standard.Count +
",IF(B2=" + DO.quote + doorType[1] + DO.quote + "," + "F1: F" + original.Count +
"," + "I1: I3" + "))))";
AddDropDown("B4", xform);
To explain more clearly I want to append strings to xform via a for loop using previously made arrays.
This is all for linking C# to excel
doorTypestays as aList<string>.doorTypeshould be something like aList<List<string>>."=IF(B2=" + DO.quote + doorType[0] + DO.quote + "," + "E1:E" + StandardDoor.Count +