public void setExcludedInterfaces(NET_FW_PROFILE_TYPE2_ fwProfile, List <string> excluded) { var objExcluded = new object[excluded.Count]; for (var i = 0; i < excluded.Count; ++i) { objExcluded[i] = excluded[i].ToString(); } if (excluded.Count == 0) { fw.set_ExcludedInterfaces(fwProfile, null); } else { fw.set_ExcludedInterfaces(fwProfile, objExcluded); } }