'System.Uri.NonPathPart' is inaccessible due to its protection level

'System.Uri.NonPathPart' is inaccessible due to its protection level

Argh! Why? Parsing URL's is a pain, the System.Uri object's got some nice utility functions that show the right values in a watch window, and I can't use them. I hate duplicating this kind of parsing, since that includes duplicating the QA effort as well.

Reminds me of trying to call DirectX functions from VB that weren't exported or exposed via the COM interface back in the day. I can see the candy, but I cannot eat the candy.

Wish: System.Uri would be less protective of its utility properties.

26 Comments

  • NonPathPart is internal because it does special casing for a UNC share when resolving a realtive file URI.

    The public counterpart is Uri.GetLeftPart(UriPartial.Authority) that will return

    scheme + userinfo + host + port.

  • A wrapper, a bit of reflection/invoke and you're done ;)



    There's always a way 'round it

  • Jean-Philippe - Agree, although that would probably take more code than just parsing the URL myself... I'd dig into reflection if there was something complex there; it's not that I can't parse a URL, I just shouldn't have to.

  • Alexei - Thanks. Makes sense.

  • Jon,



    Consider this, replacing <object> with your requirements...

    MethodInfo meth = <object>.GetType().GetMethod(MethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod);

    object result = meth.Invoke(<object>, <params>);



    this code sounds light enough for me ;)



  • It's going to be ending of mine day, except before end I am reading this great piece of writing to improve my knowledge.

  • Hi there, its pleasant article regarding media print, we all be familiar
    with media is a enormous source of data.

  • You are welcome Patty. Many thanks for visiting and I hope you
    keep returning for even more efficient pointers and tech info.
    And don't forget to inform your friends!

  • It�s exhausting to find educated individuals on this subject,
    however you sound like you know what you�re speaking about!
    Thanks

  • I really like what you guys tend to be up too.

    This type of clever work and coverage! Keep up the good works
    guys I've incorporated you guys to my personal blogroll.

  • Hi there Dear, are you genuinely visiting this site daily, if so
    after that you will definitely take nice knowledge.

  • Really nice writing. Nicely presented.

  • Overall, if you need more storage capacity, then you should definitely
    get yourself a 6th Generation i - Pod Classic. Some people
    will rely on transferring data between flash drives and their home computers, or sending what they wish to have
    printed to a proxy, such as Fed - Ex. Approach more people than you think you need and don't be afraid to ask for names and contact information of other possible investors.

  • This is extremely true for smaller businesses that do not have big money
    but need to show their clientele they appreciate their business.
    Photos might be screen printed or with a technique called dye sublimation on these mugs.
    You can present mens gift boxes that incorporate items
    that most men cannot resist; some mens gift hampers contain
    tickets into a big football game, designer cologne, toiletries, interesting books and thus on.

  • You will need to determine if it is the humidity and sweating that you are
    suffering from, as this can be relatively easy to fix. While some maintenance can be done by a homeowner, a good plumber or HVAC technician should be consulted to
    make sure that your heating system will run efficiently during the next winter season
    and for years to come. Usually take into account the following prior to
    cleaning your floors:.

  • Overall, if you need more storage capacity, then you should definitely get
    yourself a 6th Generation i - Pod Classic. The mini spy pen camera is available in
    4GB, 8GB and 16 GB for regular use as per requirement of the customer.
    Waiting until the park is about to close is one way to get some privacy, as
    is visiting the park during Disneyland's less busy times.

  • We, complete promotional items, never negotiate using the quality of our own services
    and customer happiness as it is an easy and winning approach to
    pull in your direction the clients. Coffee mugs, printed coffee mugs,
    and wholesale mugs are some on the products possessing widespread recognition.
    They in addition have mentioned that it really is easily
    washable also ,just by using some soap and water.

  • Woah! I'm really loving the template/theme of this site. It's simple, yet effective.
    A lot of times it's very difficult to get that "perfect balance" between usability and visual appearance. I must say you've
    done a awesome job with this. In addition, the blog
    loads extremely fast for me on Safari. Outstanding Blog!

  • E-books can be purchased in multiple formats, may be housed in digital portable
    devices for example usb flash drives, and are also generally readable on any system no matter configuration.
    A baby store is going to be happy to created and deliver a business gift kits with your budget.
    Flash pens are proving to become hugely popular business products and promotional items as being a result of
    huge variety of branding possibilities to choose from for virtually
    any occasion.

  • I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for
    you? Plz answer back as I'm looking to create my own blog and would like to find out where u got this from. appreciate it

  • Hi friends, its enormous post about tutoringand entirely
    defined, keep it up all the time.

  • Having read this I thought it was rather informative.
    I appreciate you finding the time and effort to put this information together.
    I once again find myself personally spending way too much time both reading
    and posting comments. But so what, it was still worth it!

  • There are certainly a lot of details like that to take into consideration.
    That may be a great point to deliver up. I provide the ideas above as normal inspiration but
    clearly there are questions like the one you bring up where crucial thing will likely be working
    in honest good faith. I don?t know if finest practices have emerged around
    things like that, but I am positive that your job is clearly identified as a fair game.
    Both girls and boys really feel the impression of only
    a moment�s pleasure, for the rest of their lives.

  • Interesting blog! Is your theme custom made or did you download
    it from somewhere? A theme like yours with a few simple adjustements would really make my blog stand out.
    Please let me know where you got your theme. Bless you

  • You will need to determine if it is the humidity and sweating that you are suffering
    from, as this can be relatively easy to fix. Regular bread-maker users might be disappointed that the control
    panel does not signal at what phase in the mixing the machine is, and that there are no programmable features for your own recipes.
    Earwigs are largely nocturnal creatures that can easily be drawn in at night
    by any lights you have in or around your home.

  • At this time I am ready to do my breakfast, afterward having my breakfast coming
    yet again to read other news.

Comments have been disabled for this content.