Microsoft Visual Studio 2010 Ultimate (Sürüm 10.0.40219.1 SP1Rel).'Dinamik' tür veya ad alanı adı bulunamadı
Microsoft .NET Framework sürüm 4.5.50709 SP1Rel
Ben .net framework 4.0'a derleme ediyorum.
tür veya ad alanı adı 'dinamik' bulunamadı: Ben dinamik veya var data tiplerini kullanmayı deneyin her
, ben konu satırında gösterilen hata alıyorum.
'var' tür veya ad alanı adı bulunamadı.
Başka bir web hizmetinden aldığım verileri ayrıştırmak için JsonFX'i kullanmaya çalışıyorum. Bazen verilerle bir "mesaj" temsil edecek ve bazen bir "parça" temsil edecektir. Buna göre JsonFx Documentation, "Dinamik türlere/seriden seri hale getirme (.NET 4.0 için varsayılan)" örneğini takip edebilmem gerekir: "
Sitemde test denen bir sayfa ekledim.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
C# için oldukça yeni ve: web.config dosyasında
using System;
using System.Text;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JsonFx;
using JsonFx.Json;
using Microsoft.CSharp;
public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string Data = "";
Data = @"[{""meta"":{""account"":""orbitinte"",""event"":""track""},""payload"":{""id"":410827200397312213,""id_str"":""410827200397312213"",""asset"":""359551031717134"",""recorded_at"":""2013-02-07T15:59:04Z"",""received_at"":""2013-02-07T16:00:37Z"",""fields"":{}}},{""meta"":{""account"":""orbitinte"",""event"":""track""},""payload"":{""id"":410827200409895125,""id_str"":""410827200409895125"",""asset"":""359551031717134"",""recorded_at"":""2013-02-07T16:00:04Z"",""received_at"":""2013-02-07T16:00:37Z"",""fields"":{}}}]";
Data = @"[{""meta"":{""account"":""orbitinte"",""event"":""message""},""payload"":{""id"":410865901198377173,""thread_id"":null,""parent_id"":410865891354345685,""id_str"":""410865901198377173"",""thread_id_str"":"""",""parent_id_str"":""410865891354345685"",""type"":""message"",""channel"":""com.mdi.services.adminProtocol"",""sender"":""359551031717134"",""recipient"":""@@[email protected]@"",""asset"":""359551031717134"",""b64_payload"":""eyJlcnJvciI6ImNhbm5vdCBwYXJzZSBjb21tYW5kIn0="",""recorded_at"":""2013-02-07T18:34:25Z"",""received_at"":""2013-02-07T18:34:24Z""}}]";
JsonReader Reader = new JsonReader();
dynamic Output = Reader.Read(Data);
Notifications oNotifications = new Notifications();
oNotifications.ProcessNotifications(Data);
}
}
: Kod bloğu aşağıdaki I kullanmaya çalışıyorum kod şudur Test.aspx.cs dan asp.net. Ama şimdi bir süredir bu problem için bir çözüm arıyordum. Gördüğüm her şey derleyici sürümü ve .net framework sürümünden bahseder. Tüm ilgili ayrıntıları sağladığımı düşünüyorum, ancak başka bir şey varsa, bu soruya eklemeliyim, lütfen bana bildirin.
2.0.0.0 Eğer 'using' ifadeleri eksik gibi herhangi saçma hatalar yok emin misiniz? Bu işlevsellik 'kutunun dışında' çalışmalıdır. Geçen yıl C# dükkanında çalışmak bu problemi hiç görmedim. – evanmcdonnal
Sanmıyorum ama emin değilim. Kullanarak ifadeleri göstermek için kod bloğunu değiştirdim. –
Ve bu bir sınıf veya ana içeride mi? – evanmcdonnal