所以我有一个集合Name,Code,Id和List与节点类型ServiceTypeDto这样的模式:
public class ServiceTypeDto
{
public long Id
public string Code
public string Name
public List<ServiceTypeDto> ChildrenList
}
Run Code Online (Sandbox Code Playgroud)
我有一个返回ServiceTypeDtos列表的方法,如下所示:

我有一个ChildernList暴露ServiceTypeDtos的。
这就是我尝试在ViewModel 中执行此操作的方式:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ServiceTypeService.Dto;
using ServiceTypeService.Interface;
using ShowServiceType.Interfaces;
using ShowServiceType.Utils;
namespace ShowServiceType.ViewModel
{
class MainWindowViewModel : ViewModelBase
{
public string _name, _code;
public long _id;
public List<ServiceTypeDto> _childrenList = new List<ServiceTypeDto>();
/// <summary>
/// Create Services for work …Run Code Online (Sandbox Code Playgroud)