Method Inaccessible due to its protection level

I'm working in C#/ASP.net and have a BizObject class with the following method:

        protected static string ConvertNullToEmptyString(string input)
        {
            return (input == null ? "" : input);
        }

I am trying to call the method as stringhere = BizObject.ConvertNullToEmptyString(stringhere) and am getting the error edu.xxx.yyy.BLL.BizObject.ConvertNullToEmptyString(String) is inaccessible due to its protection level, where edu.xxx.yyy.BLL is the actual namespace of the class making the method call as well as, obviously, the namespace of the BizObject class.  I am making the same call from another class in the namespace and that call is working just fine, but it is not working in this instance.

Any help would be appreciated
larkydooAsked:
Who is Participating?
 
surajgupthaConnect With a Mentor Commented:
The protected keyword is a member access modifier. A protected member is accessible within its class and by derived classes.

The class from which it worked when you had its access modifier as Protected, is that class derived from the BizObject??
0
 
surajgupthaCommented:
try changing protected to public
0
 
larkydooAuthor Commented:
I went in and set the method to public static instead of protected static and it works now.  This is not a desirable solution, as it should have worked to begin with.  Would still like any insight into this anyone may have.
0
 
larkydooAuthor Commented:
That's it exactly.  Thanks!
0
 
surajgupthaCommented:
If you are worried about its protection. try changing the modifer to internal which would only let access from all classes within the same assembly
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.