diff --git a/ast-table.html b/ast-table.html new file mode 100644 index 0000000..178c848 --- /dev/null +++ b/ast-table.html @@ -0,0 +1,409 @@ + + + + + + + C# Syntax to CodeQL Mapping + + + +

C# Syntax to CodeQL Mapping

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C# Syntax ElementC# Sample CodeCodeQL Class
FileN/AFile
Source FileN/ASourceFile
DirectoryN/AFolder
Classclass MyClass { }Class
Structstruct MyStruct { int x; }Struct
Interfaceinterface IMyInterface { void DoWork(); }Interface
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
C# Syntax ElementC# Sample CodeCodeQL Class
Files and Directories
FileN/AFile
Source FileN/ASourceFile
DirectoryN/AFolder
Types
Classclass MyClass { }Class
Structstruct MyStruct { int x; }Struct
Interfaceinterface IMyInterface { void DoWork(); }Interface
Enumenum MyEnum { A, B, C }Enum
Delegatedelegate void MyDelegate(string s);Delegate
Methods and Functions
Methodvoid MyMethod() { }Method
ConstructorMyClass() { }Constructor
Destructor~MyClass() { }Destructor
Operatorpublic static MyClass operator +(MyClass a)Operator
Local Functionvoid LocalFunc() { }LocalFunction
Variables and Parameters
Variableint x = 10;Variable
Local Variableint localVar = 20;LocalVariable
Parametervoid MyMethod(int param) { }Parameter
Fieldprivate int myField;Field
Statements
Block Statement{ int x = 5; }BlockStmt
If Statementif (x > 0) { }IfStmt
For Statementfor (int i = 0; i < 10; i++) { }ForStmt
Foreach Statementforeach (var item in items) { }ForEachStmt
While Statementwhile (x > 0) { }WhileStmt
Do-While Statementdo { } while (x > 0);DoStmt
Switch Statementswitch (x) { case 1: break; }SwitchStmt
Break Statementbreak;BreakStmt
Continue Statementcontinue;ContinueStmt
Return Statementreturn x;ReturnStmt
Throw Statementthrow new Exception();ThrowStmt
Try Statementtry { } catch { }TryStmt
Catch Clausecatch (Exception ex) { }CatchClause
Finally Clausefinally { }FinallyClause
Using Statementusing (var res = new Resource()) { }UsingStmt
Lock Statementlock (obj) { }LockStmt
Expressions
Expressionx + yExpr
Literal Expression42Literal
Binary Operationx + yBinaryOperation
Unary Operation-xUnaryOperation
Assignment Expressionx = 5AssignExpr
Invocation ExpressionConsole.WriteLine("Hello");InvocationExpr
Object Creation Expressionnew MyClass()ObjectCreation
Array Creation Expressionnew int[10]ArrayCreation
Cast Expression(int)xCastExpr
Conditional Expressionx > 0 ? y : zConditionalExpr
Lambda Expression(x) => x * 2LambdaExpr
Accessors and Properties
Propertypublic int MyProp { get; set; }Property
Property Accessx = MyProp;PropertyAccess
Indexerthis[int index]Indexer
Indexer Accessarray[0]IndexerAccess
Events
Eventpublic event EventHandler MyEvent;Event
Event AccessMyEvent += handler;EventAccess
Attributes
Attribute[Obsolete("Message")]Attribute
Namespaces
Namespacenamespace MyNamespace { }Namespace
+ +