C# 4.0 在web api1和.NET 4.0中是否可以将复杂类型传递给post方法

C# 4.0 在web api1和.NET 4.0中是否可以将复杂类型传递给post方法,c#-4.0,asp.net-web-api,C# 4.0,Asp.net Web Api,我有如下的课程 public class Upload { [Key()] public Guid ID{ get;set;} public string FileName {get;set;} public byte[] File { get; set; } public string FileContentType { get; set; } } 我需要一个http或webClient来调用一个接受这个复杂(对象)类型对象的WebAPI pos

我有如下的课程

public class Upload
{
    [Key()]
    public Guid ID{ get;set;}
    public string FileName {get;set;}
    public byte[] File { get; set; }   
    public string FileContentType { get; set; }
}
我需要一个http或webClient来调用一个接受这个复杂(对象)类型对象的WebAPI post方法

我可以在WebAPI2中看到许多需要.NET4.5的示例,但我需要在WebAPI1中找到一些在.NET4.0中工作的示例

遗憾的是,许多公司仍然使用.NET4.0,没有计划迁移到4.5,但他们需要.NET应用程序中的所有功能

你能告诉我这是否可行吗

我需要一个带有HttpClient或WebClient的.net客户端,或者如果有任何其他库


干杯

是的,这是可能的。如果您有任何问题,请张贴您的代码,我们将从那里开始谢谢克劳迪奥。我在另一篇文章中有示例代码。我正在努力解决这个问题。此调用需要从.NET4.0并通过一些http或Web客户端进行。我不确定这怎么可能,在这方面我找不到任何帮助。