My English is not good. So i tired to write if condition with each item in array. What is solution for this. Thank you for you help This code make me tired , so how to do it like this
public bool AllowElement(Element element)// element is object by mouse houver on Revit program
{
BuiltInCategory[] BIC = new BuiltInCategory[]{Frame, Column, Slab,Foundation, etc...}// BIC is
in enum, and this is declare with params key word
if( ele == (int)BIC.Frame || ele == (int)BIC.Column ||
ele == (int)BIC.Slab || ele == (int)BIC.Foundation ||
ele == (int)BIC.etc....)
{
return true
}
}
end this code I writed but i feel it not true
public bool AllowElement(Element element)
{
int ele = element.Category.Id.IntegerValue;
foreach (var item in BIC)
{
if (ele == (int)item)
return true;
}
return false;
}
.Anyto return a bool if any entry in the list matches a condition you specify.BICis an enum then tryif (Enum.IsDefined(typeof(BIC), ele)) { return true; }