I am attempting to create the following code through the use of CodeDom:
public partial class mainClass
{
public byte[] bytes = null;
}
I have no problem creating the class, and I found ways to declare variables through the use of CodeDom using the CodeVariableDeclarationStatement method, but I am unsure of how to add a variable declaration as part of my class.
Here is what I have tried thus far:
CodeTypeDeclaration mainClass = new CodeTypeDeclaration("mainClass");
mainClass.IsPartial = true;
mainClass.IsClass = true;
mainClass.Attributes = MemberAttributes.Public;
Namespaces.Types.Add(mainClass);
CodeVariableDeclarationStatement variableDeclaration = new(CodeVariableDeclarationStatement(typeof(byte[]), "bytes", new CodePrimitiveExpression("String.Empty");
I am open to any suggestions and ideas. Thank you for any help, Evan.