Alternative string concatenation of a two string in C#

public static string GetString(string string1,string string2)
{
char[] str1 = string1.ToCharArray();
char[] str2 = string2.ToCharArray();

string finalString = “”;
int length = str1.Length > str2.Length ? str2.Length : str1.Length;
for (int i = 0; i < length ; i++)
{
finalString = finalString + str1[i] + str2[i];
}
if (str1.Length > str2.Length)
{
int difference = str1.Length – str2.Length;
for (int i = 0; i < difference; i++)
{
char rem = str1[str2.Length + i];
finalString = finalString + rem;
}

}
else
{
int difference = str2.Length – str1.Length;
for (int i = 0; i < difference; i++)
{
char rem = str2[str1.Length + i];
finalString = finalString + rem;
}
}
return finalString;
}

string finalString = GetString(“USA”, “INDIA”);

Ouput : UISNADIA

Split numbers at nth occurrence in C#

class Program
{
static void Main(string[] args)
{

var finalResult = GetSplittedNumbers("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30",10);
}
public static List<string> GetSplittedNumbers(string stringSeparatedByComma,int n)
{
var listOfSeparatedValues = new List<string>();
List<int> splittedIntArrays =
stringSeparatedByComma.Split(',').Select(
x => Convert.ToInt32(x)).ToList();
var splittedList = new List<int>();
foreach (int item in splittedIntArrays)
{

int status = item % n;
if (splittedList == null)
{
splittedList = new List<int>();
}

splittedList.Add(item);

if (status == 0)
{

string res = AgainCommaSeparated(splittedList);
listOfSeparatedValues.Add(res);
splittedList = null;
}
}
return listOfSeparatedValues;
}
private static string AgainCommaSeparated(IEnumerable<int> numbers )
{
var result= numbers.Aggregate("", (current, number) => current + number.ToString() + ",");
return result.Substring(0, result.Length - 1);
}
}

Utilities

Get Business Days from a Date


public static IEnumerable<int> GetBusinessDays()
{
var weekends = new[] { DayOfWeek.Saturday, DayOfWeek.Sunday };
var calendarMonth = DateTime.Now;
var totalDays = DateTime.DaysInMonth(DateTime.Now.Year, calendarMonth.Month);
var businessDays = Enumerable.Range(1, totalDays).Where(d =>!weekends.Contains(new DateTime(DateTime.Now.Year, calendarMonth.Month, d).DayOfWeek));
return businessDays;
}