S
Smokey Grindel
I understand generics in VB.NET but how do you convert this C# code to
VB.NET?
/// <summary>
/// Routing handler.
/// </summary>
/// <typeparam name="T">Type of <see cref="IHttpHandler"/> to instantiate
and return.</typeparam>
public class WebFormRouteHandler<T> : IRouteHandler where T : IHttpHandler,
new()
{
public string VirtualPath { get; set; }
public WebFormRouteHandler( string virtualPath )
{
this.VirtualPath = virtualPath;
}
#region IRouteHandler Members
public IHttpHandler GetHttpHandler( RequestContext requestContext )
{
foreach ( var value in requestContext.RouteData.Values )
{
requestContext.HttpContext.Items[ value.Key ] = value.Value;
}
return ( VirtualPath != null )
? (IHttpHandler)BuildManager.CreateInstanceFromVirtualPath( VirtualPath,
typeof( T ) )
: new T();
}
#endregion
}
VB.NET?
/// <summary>
/// Routing handler.
/// </summary>
/// <typeparam name="T">Type of <see cref="IHttpHandler"/> to instantiate
and return.</typeparam>
public class WebFormRouteHandler<T> : IRouteHandler where T : IHttpHandler,
new()
{
public string VirtualPath { get; set; }
public WebFormRouteHandler( string virtualPath )
{
this.VirtualPath = virtualPath;
}
#region IRouteHandler Members
public IHttpHandler GetHttpHandler( RequestContext requestContext )
{
foreach ( var value in requestContext.RouteData.Values )
{
requestContext.HttpContext.Items[ value.Key ] = value.Value;
}
return ( VirtualPath != null )
? (IHttpHandler)BuildManager.CreateInstanceFromVirtualPath( VirtualPath,
typeof( T ) )
: new T();
}
#endregion
}