Можно оформить классы вот так:
public class CommandResult
{
public string Command {get;set;}
}
public class CommandResult<T>:CommandResult
{
public T Data {get;set;}
}
public class FilesList
{
public string[] Files {get;set;}
}
public class UserInfo
{
...
}
и используешь в WebApi
public class MyAwesomeController:ApiController
{
public CommandResult<FilesList> GetFilesList(){
...
return new CommandResult<FilesList> (){
Command = "FilesList",
Data = new FilesList(){Files = new []{"file1","file2","file3","file4"}}
};
}
public CommandResult<UserInfo> GetUserInfo(){
...
}
}
или со своей логикой
public class MyAwesomeCommands
{
private CommandResult<FilesList> _getFilesList(){
...
return new CommandResult<FilesList> (){
Command = "FilesList",
Data = new FilesList(){Files = new []{"file1","file2","file3","file4"}}
};
}
public string GetFilesList(){
var data = getFilesList();
return JsonConvert.SerializeObject(data);
}
public string GetUserInfo(){
...
}
}