简体   繁体   English

当我尝试添加参考时,Visual Studio 得到这个:Instance object set as constant

[英]Visual studio when i try to add reference get this : Instance object set as constant

I dont know what does it say or how to fix it anyone has idea?我不知道它说什么或如何解决任何人有想法? I also have tried to add this plugin interface to another project but got same error.我也尝试将此插件接口添加到另一个项目,但得到了同样的错误。 So I think the problem is about this plugin setup.所以我认为问题在于这个插件设置。 Here is my interface below下面是我的界面

using DEMIRBANKLIB;
namespace DPlugin
{
    public interface DPlugin
    {
        public enum EVENTTYPE {GETPACKAGE,SENDPACKAGE,LOADTABLE }
        public string Name { get; set; }   
        public string Description { get; set; }
        public EventManager manager { get; set; }
        public void Run();
    }
    public class EventManager
    {
        IPaket paket;
        Dictionary<DPlugin.EVENTTYPE,EventDelegate> events = new Dictionary<DPlugin.EVENTTYPE,EventDelegate>();
        public delegate void EventDelegate(IPaket paket);

        public bool RegisterEvent(DPlugin.EVENTTYPE TYPE,EventDelegate del)
        {
            if (events[TYPE] == null)
                events.Add(TYPE, del);
            else
                return false;
            return true;
        }
    }
}


Here is the plugin i want to use.这是我要使用的插件。

using DPlugin;
using DEMIRBANKLIB;
namespace PaketEventP
{
    public class PEP : DPlugin.DPlugin
    {
        public string Name { get; set; }    
        public string Description { get; set; }
        public EventManager manager { get; set; }
        public PEP()
        {
            Name = "Paket Eventi Plugin";
            Description = "Paket eventleri ile bir şeyler yapcak";
            manager = new EventManager();
            
        }

        public void Run()
        {
            manager.RegisterEvent(DPlugin.DPlugin.EVENTTYPE.GETPACKAGE, paketAlEvent); 
        }
        public void paketAlEvent(IPaket paket)
        {
            MessageBox.Show(paket.detay);
        }
    }
}

I solved this by editing solution codes manually.我通过手动编辑解决方案代码解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试保存实体时,出现错误:对象引用未设置为对象的实例 - When I try to save an entity I get the error: Object reference not set to an instance of an object 当我尝试连接2个DataTable时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object when I try to join 2 DataTables 尝试向列表中添加元素时,获取“对象引用未设置为实例” - Get “Object reference not set to an instance” when trying to add element to list 将数据从Excel导入到Visual Studio dataGridView。 得到此错误对象引用未设置为对象的实例 - Importing data from Excel to Visual studio dataGridView. Get this error Object reference not set to an instance of an object 错误:对象引用未设置为对象企业架构师和Visual Studio的实例 - Error:Object reference not set to an instance of an object enterprise architect and visual studio 当我尝试实例化未设置为对象实例的String []对象引用时发生错误 - ERROR when I try to instantiate a String[] object reference not set to an instance of an object 使用Visual Studio设计器-“对象引用未设置为对象的实例”(Visual Studio 2008) - Using the Visual Studio designer - “Object reference not set to an instance of an object” (Visual Studio 2008) 添加[PrincipalPermission(SecurityAction.Demand,Role =“ ADMIN”)]时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object when I add [PrincipalPermission(SecurityAction.Demand, Role = “ADMIN”)] 当我尝试在visual studio 2010中添加web服务时遇到问题 - Facing issues when I try to add a webservice in visual studio 2010 我尝试添加文件时Visual Studio冻结 - Visual Studio Freezes when I try to Add a file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM