R
Rod Bass
I was disappointed to see that you can't use a parameter type as a base
class for a generic class. I would find it extremely useful to extend a
generic type of class (as is done nicely using C++ templates). For example:
public class SoapClientProtocolWithHeaders<T>: T
where T: System.Web.Services.Protocols.SoapHttpClientProtocol
{
protected NameValueCollection m_Headers = new NameValueCollection();
public NameValueCollection Headers { get { return m_Headers; } }
protected override System.Net.WebRequest GetWebRequest(System.Uri uri)
{
System.Net.WebRequest wr = base.GetWebRequest(uri);
wr.Headers.Add(m_Headers);
return wr;
}
}
I currently use the CodeDOM to gen this code in memory and I was looking
forward to converting it to a generic class. I would guess that you must
have contemplated this and there a good reason that this cannot be done?
class for a generic class. I would find it extremely useful to extend a
generic type of class (as is done nicely using C++ templates). For example:
public class SoapClientProtocolWithHeaders<T>: T
where T: System.Web.Services.Protocols.SoapHttpClientProtocol
{
protected NameValueCollection m_Headers = new NameValueCollection();
public NameValueCollection Headers { get { return m_Headers; } }
protected override System.Net.WebRequest GetWebRequest(System.Uri uri)
{
System.Net.WebRequest wr = base.GetWebRequest(uri);
wr.Headers.Add(m_Headers);
return wr;
}
}
I currently use the CodeDOM to gen this code in memory and I was looking
forward to converting it to a generic class. I would guess that you must
have contemplated this and there a good reason that this cannot be done?