CodeDom C#

Beschreibung

C# CodeDOM keywords and explanations
Thiago Avelino
Karteikarten von Thiago Avelino, aktualisiert more than 1 year ago
Thiago Avelino
Erstellt von Thiago Avelino vor fast 9 Jahre
48
0

Zusammenfassung der Ressource

Frage Antworten
Code Compile Unit Class that Represents the file. CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
CodeNamespace and CodeNamespaceImport The CodeNamspace class is used to represent the namespace. codeNamespace = new CodeNamespace("Reflection");
CodeNamespaceImport The CodeNamespaceImport class is used to define the namespace you would like to import. In C# you use the using keyword. codeNamespace.Imports.Add(new CodeNamespaceImport("System"));
CodeTypeDeclaration The next step is to declare the class. CodeTypeDeclaration targetClass = new CodeTypeDeclaration("Calculator"); targetClass.IsClass = true; targetClass.TypeAttributes = TypeAttributes.Public; codeNamespace.Types.Add(targetClass);
CodeMemberField Addd the fields to the class. CodeMemberField xField = new CodeMemberField(); xField.Name = "x"; xField.Type = new CodeTypeReference(typeof(double)); targetClass.Members.Add(xField);
CodeMemberProperty CodeMemberProperty xProperty = new CodeMemberProperty();
CodeMemberProperty getters and setters The CodeMemberProperty class has two properties (HasGet and HasSet) that you need to set to true.
GetStatements The GetStatements collection property is used to add the code to the Get accessor.
CodeThisReferenceExpression The CodeThisReferenceExpression class is used because in C# you use this; in VB you use Me..
SetStatements The SetStatements collection property contains the code to set the this.x field.
CodeMemberMethod To create methods using the CodeDOM, you need to use the CodeMemberMethod class.
CodeMemberMethod.Attributes It]s not the method atributes but the method decorators: public, static, final, new, private, etc.
CodeConditionStatement if statements ifLogic.Condition = new CodeBinaryOperatorExpression ifLogic.TrueStatements.Add ifLogic.FalseStatements.Add divideMethod.Statements.Add(ifLogic);
CodeParameterDeclarationExpression Defines the methods parameters CodeParameterDeclarationExpression powerParameter = new CodeParameterDeclarationExpression(typeof(double), "power"); exponentMethod.Parameters.Add(powerParameter);
CodeMethodInvokeExpression The CodeMethodInvokeExpression class is used to call a method and pass a parameter to the method.
BracingStyle the BracingStyle property to “C” places the brackets, {}, on separate lines.
CodeGeneratorOptions The CodeGeneratorOptions class has properties that enable you to control the formatting of your automatically generated code
TrueStatements CodeConditionStatement used to add statements to the true path of logic using the CodeDOM
CodeDOMProvider class in the CodeDOM used to generate a class file
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Tipps zum Erstellen von Mindmaps
max.grassl
Französisch Vokabeln Découvertes 1, Leçon 1, Karteikarten
AntonS
Mathe Themen
barbara91
Faust I
barbara91
B, Kapitel 2, Arbeits- und Sozialordnung
Stefan Kurtenbach
Ecologie politique - Vocabulaire
Gaelle Bourgeois
1.2 Die Entwicklung der modernen Psychologie
achdrewes
BAS1 Funktion von Kreislauf und Atmung
dennis.konscholke
GPSY PEPS
Simon Wirsching
EC Klinische Psychologie
Sandra S.
Vetie - Innere Medizin (Allgemein)
Fioras Hu