无法定义,利用动态的,因为所需的编译器类型类或成员 [英] Cannot define class or member that utilizes dynamic because the compiler required type

查看:941
本文介绍了无法定义,利用动态的,因为所需的编译器类型类或成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook的SDK C#库Asp.Net 3.5应用。当我试图编译下面的代码给我的错误。据我所知使用4.0框架的动态类型。
原来是无论如何重写才能使其发挥作用?
我必须System.Core程序3.5参考,但它仍然没有编制

 保护无效的Page_Load(对象发件人,EventArgs E)
{
如果(Request.Params.AllKeys.Contains(signed_request))
{
VAR的结果= FacebookSignedRequest.Parse(FacebookContext.Current.AppSecret,询价。 PARAMS [signed_request]);
动态signedRequestValue = result.Data;
this.RegistrationData = signedRequestValue.registration;
}
,否则
{
的Response.Redirect(〜/);
}
}

保护动态RegistrationData {搞定;组; }


错误1无法定义,利用动态,因为编译器所需的类型System.Runtime.CompilerServices.DynamicAttribute'无法找到一个类或成员。你缺少System.Core.dll参考?

错误2无法定义,利用动态,因为编译器所需的类型System.Runtime.CompilerServices.DynamicAttribute'无法找到一个类或成员。你缺少System.Core.dll参考?


解决方案

动态是在C#4.0中提供。



您有您的应用程序转换为4.0版本
更改引用的程序集(System.Core程序)到4.0版本。


I'm using Facebook SDK C# Library in Asp.Net 3.5 Application. When I'm trying to compile the code below give me the errors. As I know dynamic type using in 4.0 framework. So is anyway to rewrite it in order make it work? I have a reference to System.Core 3.5 but it's still not compiling

protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params.AllKeys.Contains("signed_request"))
            {
                var result = FacebookSignedRequest.Parse(FacebookContext.Current.AppSecret, Request.Params["signed_request"]);
                dynamic signedRequestValue = result.Data;
                this.RegistrationData = signedRequestValue.registration;
            }
            else
            {
                Response.Redirect("~/");
            }
        }

protected dynamic RegistrationData { get; set; }


Error   1   Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference to System.Core.dll?  

Error   2   Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference to System.Core.dll?  

解决方案

dynamic is available in C# 4.0.

You have to convert your application to 4.0 version Change the referenced assemblies(System.Core) to 4.0 version.

这篇关于无法定义,利用动态的,因为所需的编译器类型类或成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆