0

I am new to VBA, tasked to convert VBA code to C#. I am trying to convert the following code from VBA to C#:

Dim xml As New MSXML2.DOMDocument

Dim node
Set node = xml.createElement("base64")
node.dataType = "bin.base64"
node.nodeTypedValue = ConvertStringToBinary(rawString)

Base64Encode = node.text

Set node = Nothing
Set xml = Nothing

This is I have converted so far:

var xml = new XmlDocument();
var node = xml.CreateElement("base64");
//What's the c# equivalent of the rest
xml = null;
node = null;

Can anyone help me to fix this .

GSerg
  • 76,472
  • 17
  • 159
  • 346
Zhu
  • 3,679
  • 14
  • 45
  • 76
  • 1
    What is the *intent* of the VBA code? Is it to Base64-decode some data? If so, there is [`Convert.FromBase64String`](https://stackoverflow.com/q/7134837/1115360). – Andrew Morton Nov 18 '19 at 10:19
  • 1
    As already mentioned, all your code does is does Base64 conversion. You don't need an XML library to do this, just follow the link and use `Convert.FromBase64String` – Nick.Mc Nov 18 '19 at 10:33

0 Answers0