并不总是但偶尔我不断得到以下错误,它不会影响我"我认为",但我想知道这背后的原因以及我如何解决它.我尝试disposing了上下文,但我没有看到任何改进.下面是我得到的错误日志.
3/16/2017 7:06:55 AM ERROR IN PLM data into file System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.SqlServerCe.NativeMethods.CompileQueryPlan(IntPtr pQpCommand, String pwszCommandText, ResultSetOptions options, IntPtr[] pParamNames, IntPtr prgBinding, Int32 cDbBinding, IntPtr& pQpPlan, IntPtr pError)
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.Entity.SqlServerCompact.SqlCeMultiCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) …Run Code Online (Sandbox Code Playgroud) 好的,所以我有一个包含少量字符串数据集的列表,我想根据下面的代码将此列表值分配给枚举
namespace ILS.VM.Config
{
public class loadPortDetails
{
public void Ports()
{
List<string> portnameLIST= new List<string>();
portnameLIST.add(31);
portnameLIST.add(25);
portnameLIST.add(66);
//BaudRate.Baud_11001 = ;
}
}
public enum BaudRate
{
Baud_FLOOR1,
Baud_FLOOR2,
Baud_FLOOR3,
Baud_NONE = 0
};
}
Run Code Online (Sandbox Code Playgroud)
列表中的数据必须作为枚举值给出
例如:
Baud_FLOOR1=should have the values from portlist (portnamelist[1])
Run Code Online (Sandbox Code Playgroud)
Baud_FLOOR2 =应该有来自portlist(portnamelist [2])的值