在Skype bot框架中,附件内容为空

在Skype bot框架中,附件内容为空,skype,botframework,skypedeveloper,Skype,Botframework,Skypedeveloper,我正在尝试访问用户发送到我正在开发的skype机器人的附件列表 以下是我访问附件详细信息的方式 public async Task<HttpResponseMessage> Post([FromBody]Activity message) { if (message.Attachments != null) { if (message.Attachments.Count > 0)

我正在尝试访问用户发送到我正在开发的skype机器人的附件列表

以下是我访问附件详细信息的方式

     public async Task<HttpResponseMessage> Post([FromBody]Activity message)
     {

        if (message.Attachments != null)
        {
            if (message.Attachments.Count > 0)
            {
                List<Attachment> attachmentList = message.Attachments.ToList();

                foreach (var item in attachmentList)
                {
                    var name = item.Name;
                    var content = item.Content;
                }
            }
        }
     }

我这样做对吗?

也许可以这样做

List<Attachment> attachmentList = message?.Attachments?.Where(x => x != null)?.ToList() ?? new List<Attachment>();
这将希望始终将attachmentList设置为空列表或包含非空项的列表?

的可能重复项
List<Attachment> attachmentList = message?.Attachments?.Where(x => x != null)?.ToList() ?? new List<Attachment>();