Search results

  1. brendan.hill

    Best way to extend XmlDocument?

    Hmm the issue here is that repeated retrievals of child XmlElement nodes would result in the XML being serialized & deserialized on each request.
  2. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    Thanks for the clarification, in the end I've gone with a wrapper class (private declaration of XmlElement instead of inheritance) which loses all the native functionality of XmlElement, unfortunately.
  3. brendan.hill

    Best way to extend XmlDocument?

    I would like to extend the functionality of XmlDocument and XmlElement to make it easier to add new children, multiple values at once, etc, for example this function would be useful: Public Function AddValues(paramarray NameThenValue() as object) . End Function Dim x as XmlElement . ...
  4. brendan.hill

    Constructing XML string by string - what do you think?

    Well...... 4 page proposal submitted.
  5. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    Well the issue then is that what I"m casting from (XmlElement) actually isn't a SimpleXmlElement - that's the whole point. I'm taking the response from XmlElement.appendChild() (which is XmlElement) and I want to return it as SimpleXmlElement (derived class).
  6. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    In fact there are no additional variables, only additional functions and subroutines. SimpleXmlElement is simply the addition of some shortcut functions to XmlElement, rather than adding any functionality. Using this approach, I would effectively need to load the XML of the XmlElement passed...
  7. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    Also for the record I have tried casting functions: Public Shared Narrowing Operator CType(ByVal XmlElement As System.Xml.XmlElement) As SimpleXmlElement . . End Operator I'm not sure what this contain, and anyway it produces this error: "Conversion operators cannot convert from a...
  8. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    Alternatively, can I get a derived class to set it's own MyBase? This way, SimpleXmlElement could accept XmlElement as a constructor parameter, set MyBase, and continue as normal. I don't really see why this shouldn't be possible. For example this would be ideal: Public Class SimpleXmlElement...
  9. brendan.hill

    Question OO question: how to cast from a base class to a derived class?

    OK I know this isn't supposed to be possible, because you can't be sure the object is really of the derived class (can't cast a mammal as a cat because it might be a dog, etc). The thing is, I have a legitimate need to achieve this somehowand see no problem in this circumstance. I'm writing a...
  10. brendan.hill

    Constructing XML string by string - what do you think?

    Hi, I recently joined a new development team (developing mission critical financial services systems) and was horrified to find that they created XML using StringBuilder, and even worse sometimes, by string arrays & increments. Adjustments to XML were sometimes as terrible as stripping of last...
  11. brendan.hill

    Question Obscure problem - optional parameter with empty string treated as Nothing!?

    The code I posted was just to isolate the problem. The actual function I use is: Public Function is_null(ByVal value As Object) As Boolean Return (value Is Nothing) OrElse value.Equals(System.DBNull.Value) End Function Public Function check_string(ByVal value As Object, Optional ByVal...
  12. brendan.hill

    Question Obscure problem - optional parameter with empty string treated as Nothing!?

    Thought so. Not exactly a strong enough reason to upgrade though... :p
  13. brendan.hill

    Question Obscure problem - optional parameter with empty string treated as Nothing!?

    Would that it were... not that simple! This code: Public Class Form1 Public Function get_value(Optional ByVal alternative_value As String = "") As String Return alternative_value End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As...
  14. brendan.hill

    Question Obscure problem - optional parameter with empty string treated as Nothing!?

    Sweet, done. This wasn't the problem, however I've isolated it further. It's even stranger than I thought (though less of a problem, thankfully). Turns out the function is correctly returning an empty string when run in code, but returns Nothing (or appears to) when returning in the Immediate...
  15. brendan.hill

    Question Obscure problem - optional parameter with empty string treated as Nothing!?

    Weird. This code produces Nothing instead of "": Public Function get_value(Optional ByVal alternative_value As String = "") As Object Return alternative_value End Function dim d as object = get_value() Why ideas why? It should return "" instead of Nothing as that's the parameter's...
Top Bottom