Error inconsistent accessibility method C#

Error inconsistent accessibility method C#

Content Index :

Error inconsistent accessibility method C#
Tag : chash , By : Matthew Steed
Date : November 26 2020, 01:01 AM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Why does my method declaration generate an inconsistent accessibility error?

Tag : chash , By : Tom
Date : March 29 2020, 07:55 AM
will help you MyListDB type needs to be declared as public.
Your method is public and hence the type it returns needs to be public as well (if it wasn't, how else would you access it from anywhere?).

Inconsistent Accessibility: Parameter type is less accessible than method error

Tag : chash , By : johntynan
Date : March 29 2020, 07:55 AM
it should still fix some issue If BanjoState is an enum, I have made some assumptions about the rest of your code and added comments to show what is wrong:
namespace BanjoStore
    class Program
        static void Main(string[] args)
            //Create a Banjo!
            var myFirstBanjo = new Banjo("it's my first!", 4, 67, Banjo.BanjoState.Used);
            //Oh no! The above line didn't work because I can't access BanjoState!
            //I can't used the enum to pass in the value because it's private to the 
            //Banjo class. THAT is why the error was visible in the constructor. 
            //Visual Studio knew this would happen!

    class Banjo
        //These are private by default since there isn't a keyword specified 
        //and they're inside a class:
        string description;
        int price;

        //This is also private, with the access typed in front so I don't forget:
        private int banjoID; 

        //This enum is private, but it SHOULD be:
        //public enum BanjoState
        //Even better, it can be internal if only used in this assembly
        enum BanjoState

        public Banjo(string inDescription, int inPrice, int inBanjoID,
                     BanjoState inState)
            description = inDescription;
            price = inPrice;
            banjoID = inBanjoID;
            BanjoState state = inState;
class BanjoState //This class is internal, not public!
    // Methods, properties, fields, events, delegates 
    // and nested classes go here.

Error 1 Inconsistent accessibility: return type is less accessible than method

Tag : chash , By : Antony Briggs
Date : March 29 2020, 07:55 AM
wish helps you Your Composite class is not public. You can't return a non-public type from a public method.
If you don't specify an accessibility for a non-nested class then internal is used by default. Add public to your Composite class definition:
public class Composite
private Composite buildComposite(ComboBox subs, ComboBox bas)

Inconsistent accessibility error: parameter is less accessible than method

Tag : chash , By : Piotr Balas
Date : March 29 2020, 07:55 AM
I hope this helps you . Your ModBoxUpdateInfoForm constructor is public and requires a parameter of type ModBoxUpdateXml which is internal. You get this exception because a caller outside of your assembly couldn't call the public ModBoxUpdateInfoForm constructor, because the caller is not allowed to have knowledge of what a ModBoxUpdateXml is.
Either make ModBoxUpdateXml public, or make the ModBoxUpdateInfoForm constructor internal.
internal class A{}

public class B
    public B(A a){}
//Make this public
public class A{}

public class B
    public B(A a){}
internal class A{}

//Make this internal
internal class B
    public B(A a){}
internal class A{}

public class B
    //Make only the constructor internal
    internal B(A a){}

Why am I obtaining this inconsistent accessibility error on the return type of a method?

Tag : chash , By : protagonist
Date : March 29 2020, 07:55 AM
seems to work fine Your method is public but Inoltro is internal. You cannot have a public method that exposes an internal type. Either make the method internal or the type public.
While we are looking at your code, a few things come to mind.
using (SqlConnection con = ArxeiaConnection.getARXEIAStringConnection(config.Tenant + "_" + config.Database))
    using (SqlCommand cmd = new SqlCommand(query, con))
using (SqlConnection con = ArxeiaConnection.getARXEIAStringConnection(config.Tenant + "_" + config.Database))
using (SqlCommand cmd = new SqlCommand(query, con))
Related Posts Related QUESTIONS :
  • Convert OpenSSL encryption into native C#
  • Accessing Properties in Razor Pages
  • How to get SOAP element value
  • Projection after Group
  • C# error cannot convert sytem.text.regularexpressions.match to string
  • Issues with Save/Load System in a Text Based Adventure game made with ScriptableObjects in Unity
  • VS2019 MSBuild.exe - ASP .Net MVC project fails to publish when using PublishProfile, but works when using OutDir parame
  • Does <pages validateRequest="false" /> in Web.config still matter?
  • How to send new request to redirect URL with new access token
  • Attempt to invoke virtual method on a null object reference Xamarin LockScreen
  • "The attribute names could not be inferred from bind attribute 'bind-value'" exception in Blazor
  • How to fix ''System.ArgumentException" in c#?
  • C#. Ref returning delegate for ref extension method
  • Swashbuckle Swagger generate an actual guid
  • Trying to make thousands of database calls simultaneously - they stack instead of running concurently
  • run mstest from cmd using testcontainer
  • How to make M:N (many-to-many) relationship where both M and N are the same entities?
  • Consume COM DLL from multiple clients
  • Convert json string response representing UCHAR array to Byte array
  • Why does this LinqPad program produce different results on the second run?
  • ServiceStack how to use MaxLoginAttempts feature
  • What does "late-bound access to the destination object" mean?
  • How to load appsettings.json inside a Static class based on deploy environment so that I can use in other class librarie
  • dynamically add images to view
  • Are static extension methods on User object safe?
  • Process thousands of database calls simultaneously
  • Trying to decrypt a string with public key(not private) using bouncycastle in .net
  • How to retrieve the name of an usb device
  • Query many-to-many related data using Entity Framework Core
  • ASP.NET MVC : how to find the view from a controller?
  • Inconsistent behaviour using Entity Framework for ASP.NET MVC app vs windows service
  • AutoFixture Customize vs Build
  • How to change textbox location at the click of a mouse in live mode?
  • How can I deserialize a XML file without defining the parent node?
  • asp.net core how decrease class coupling
  • ASP.NET Core Razor Pages Routing With parameters
  • String Escaping With $ Interpolation and @ Encoding
  • ConfigurationManager in ASP.NET WebAPI tested with HttpServer
  • Top down shooting in Unity 2D don't work as I want it to
  • Use own redirectUri when the Authentication expires
  • Using "foreach" in string array c#
  • "Object reference not set to an instance of an object" for create multiply models on one view
  • Get data passed trought pushAsync
  • Selector expression dynamic on IQueryable
  • Logut with SignInManager not calling method
  • Exit event handler with MessageBox OK button
  • Can not load view from Custom Renderer Xamarin Forms
  • Looking for a .Net ORM
  • Cost of SortedDictionary.Count
  • All possible combinations of n items selected randomly from a set of x items (algorithm)
  • Displaying process percentage on DOS screen
  • C# Importing Large Volume of Data from CSV to Database
  • c# control location precision
  • Printing to Zebra printer gives faint and blurry images
  • How to avoid stepping into dll code file?
  • Programmaticaly prevent Vista desktop search (WDS) from indexing pst files placed on mapped network drives
  • Is there anyway to reduce IsolatedStorage capacity in Silverlight?
  • C#: How to print a unicode string to console?
  • Frequency Table with Random Values
  • My Visual Studio 2008 web application keeps throwing a .Net error when I first run it, but refreshing fixes it
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com