System.TypeLoadException: Method 'get_xxx' does not have an implementation

前端 未结 7 1959
无人及你
无人及你 2021-01-12 00:16

There are a lot of questions floating around with this problem and i\'ve worked through them ll with no joy.

I am receiving this error:

Method

7条回答
  •  迷失自我
    2021-01-12 01:03

    try this

    public interface IResourceCompiler
    {
        string UserImageCDNUrl {get;}
    }
    
    public abstract class WebConfigBase : IResourceCompiler
    {
        public abstract string UserImageCDNUrl {get;}
    }
    
    public class WebConfig : WebConfigBase 
    {
        public override string  UserImageCDNUrl { return "whatever you want";}
    }
    

    or that way too:

    public interface IResourceCompiler
    {
        string UserImageCDNUrl {get;}
    }
    
    public abstract class WebConfigBase : IResourceCompiler
    {
        public virtual string UserImageCDNUrl {get { return string.empty;}}
    }
    
    public class WebConfig : WebConfigBase 
    {
        public override string  UserImageCDNUrl { return "whatever you want";} // or return base.UserImageCDNUrl ;
    }
    

提交回复
热议问题