我已经看过:One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?但是在尝试了顶级解决方案以及我研究过的其他解决方案后,我仍然无法解决此错误。我的VS面向.NET 4.5.1。此外,还添加了对CSharp的引用。为什么我仍然会收到此错误?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Net;
using Important.CoreInterfaces;
using Adaptive.SimpleBinaryEncoding;
private static T method<T>(byte[] pinned_memory, ref int offset)
{
//dynamic var = typeof(T);
dynamic temp = 1;
DirectBuffer tempd = new DirectBuffer(pinned_memory);
char messageType = (char)pinned_memory[offset];
switch(messageType)
{
case 'H':
doStuff();
break;
case 'D':
doOtherStuff();
break;
case 'A':
stuff();
break;
case 'M':
break;
case 'P':
break;
case 'F':
break;
case 'K':
break;
case 'O':
break;
case 'C':
break;
case 'X':
break;
default:
break;
}
MessageHeaderEncoder header = new MessageHeaderEncoder();
header.Wrap(tempd, offset, 1);
temp.WrapForDecode(tempd, offset, temp.sbeBlockLength(), temp.sbeSchemaVersion());
}