Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6119611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:34:24+00:00 2026-05-23T15:34:24+00:00

For a cross platform library in C#, I wish to have a certain set

  • 0

For a cross platform library in C#, I wish to have a certain set of methods marked protected for extensibility purposes. These methods are later accessed by reflection, using meta-programming with attributes

However, on Windows Phone 7 accessing protected methods by reflection isn’t allowed, and instead I wish for them to be marked internal.

So what I’m wondering, is if I could do something like this, in C#, or if there’s a better workaround for it?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#if WINDOWS_PHONE
    #define ACCESSOR internal
#else
    #define ACCESSOR protected
#endif

namespace Example
{
    public class MyTestClass
    {
        [MyAttribute]    
        ACCESSOR void MyMethod()
        {
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:34:25+00:00Added an answer on May 23, 2026 at 3:34 pm

    You can do this:

    [MyAttribute]
    #if WINDOWS_PHONE 
    internal
    #else
    protected
    #endif
    void MyMethod()
    {         
    } 
    

    But you’re better off making them internal or protected internal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cross-platform shared library, and I am using GNU autotools for the
I have a cross-platform application (game). It uses SDL library. I can't link it
Does anyone have any suggestions for a good cross platform input library? I'd like
I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point
I am looking for a cross platform Library in C++ that can run a
Is there a cross-platform network library for the iPhone? Is ACE available for the
I'm looking for some easy to use cross-platform threading library written in C++. What's
Looking for a library or a fairly cross platform method to get CPU utilization,
What's a high performance hashing library that's also cross platform for C/C++. For algorithms
I am looking for a cross-platform C++ master/worker library or work queue library. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.