using System.Collections.Generic;
public class CompanyAEmployee
public string FullName { get; set; }
public string Title { get; set; }
public List<CompanyAEmployee> Children { get; set; }
public class CompanyBEmployee
public string Name { get; set; }
public string PositionName { get; set; }
public List<CompanyBEmployee> Children { get; set; }
public static class ClassConverterExtensions
public static CompanyBEmployee ToCompanyBEmployee(this CompanyAEmployee that)
var result = new CompanyBEmployee();
result.Name = that.FullName;
result.PositionName = that.Title;
if(that.Children == null)
result.Children = new List<CompanyBEmployee>();
foreach(var item in that.Children)
result.Children.Add(item.ToCompanyBEmployee());
public static class Program
public static void Main()
Console.WriteLine("Start!");
var item = new CompanyAEmployee();
var converted = item.ToCompanyBEmployee();
Console.WriteLine("End!");