Hi. I am trying to add a procedure to a C# project. The procedure contains
typeof(UriParser)
but I get a compiler error:
The type or namespace name 'UriParser' could not be found (are you missing a using directive or an assembly reference?)
The following lines are included above the namespace:
<pre lang="C#">
using System;
using System.Text;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Reflection;</pre>
and the references in Solution Explorer are System, System.Data, System.Windows,Forms and System.Xml.
What reference am I missing?
The entire procedure is to do with removing an unescaped slash from the url:
public void LeaveDotsAndSlashesEscaped()
{
var getSyntaxMethod =
typeof(UriParser).GetMethod("GetSyntax", BindingFlags.Static | BindingFlags.NonPublic);
if (getSyntaxMethod == null)
{
}
var uriParser = getSyntaxMethod.Invoke(null, new object[] { "http" });
var setUpdatableFlagsMethod =
uriParser.GetType().GetMethod("SetUpdatableFlags", BindingFlags.Instance | BindingFlags.NonPublic);
if (setUpdatableFlagsMethod == null)
{
}
setUpdatableFlagsMethod.Invoke(uriParser, new object[] { 0 });
}
(I also commented out the 'throw new ...' lines because they cause 2 other errors, but I am handling errors elsewhere, so it doesn't matter.)
Thank you for your help.
What I have tried:
The actual issue is the 'unwanted backslash in url' problem in a Windows CE6.0 Net Compact Framework project, and I have looked at a number of would-be solutions in VB.net and also C#, but all have major problems with the CE6.0 and Net CF. This solution (above) only has one error to get rid of, so I am sticking with it till the error is gone!