private string GetFeature(int wordId, params int[] fields) { string[] allFeatures = GetAllFeaturesArray(wordId); if (allFeatures is null) { return(null); } StringBuilder sb = new StringBuilder(); if (fields.Length == 0) { // All features foreach (string feature in allFeatures) { sb.Append(CSVUtil.QuoteEscape(feature)).Append(","); } } else if (fields.Length == 1) { // One feature doesn't need to escape value sb.Append(allFeatures[fields[0]]).Append(","); } else { foreach (int field in fields) { sb.Append(CSVUtil.QuoteEscape(allFeatures[field])).Append(","); } } return(sb.Remove(sb.Length - 1, 1).ToString()); }