CSharp · Console
using System;
using System.Collections.Generic;
public class Program
{
public static void Main(string[] args)
{
string a = "",
b = "",
c = "Какой-то текст.";
List<string> input = new List<string>() {
a, b, c
};
string temp = default;
foreach (string i in input){
temp += i;
}
Console.WriteLine("Массив до: " + temp);
temp = null;
DefaultValue(ref input);
foreach (string i in input){
temp += i;
}
Console.WriteLine("Массив после: " + temp);
}
public static void DefaultValue (ref List<string> input)
{
for (int i=0; i<input.Count; i++)
{
if (string.IsNullOrEmpty(input[i])) {
input[i] = "N/A";
}
}
}
}