public CSParameterList And(string type, string identifier, CSParameterKind parameterKind = CSParameterKind.None, CSConstant defaultValue = null) { return(And(new CSParameter(new CSSimpleType(Exceptions.ThrowOnNull(type, nameof(type))), new CSIdentifier(Exceptions.ThrowOnNull(identifier, nameof(identifier))), parameterKind, defaultValue))); }
public static CSAttribute FieldOffset(int offset) { CSArgumentList args = new CSArgumentList(); args.Add(CSConstant.Val(offset)); return(new CSAttribute(new CSIdentifier("FieldOffset"), args, true)); }
public CSParameter(CSType type, CSIdentifier name, CSParameterKind parameterKind = CSParameterKind.None, CSConstant defaultValue = null) { CSType = Exceptions.ThrowOnNull(type, nameof(type)); Name = Exceptions.ThrowOnNull(name, nameof(name)); ParameterKind = parameterKind; DefaultValue = defaultValue; }
public static CSLine ThrowLine <T> (T exType, string message) where T : Exception { CommaListElementCollection <CSBaseExpression> args = new CommaListElementCollection <CSBaseExpression> (); if (message != null) { args.Add(CSConstant.Val(message)); } return(ThrowLine(exType, args)); }
public static CSAttribute DllImport(CSBaseExpression dllName, string entryPoint = null) { CSArgumentList args = new CSArgumentList(); args.Add(dllName); if (entryPoint != null) { args.Add(new CSAssignment("EntryPoint", CSAssignmentOperator.Assign, CSConstant.Val(entryPoint))); } return(new CSAttribute(new CSIdentifier("DllImport"), args, true)); }
public static CSBaseExpression operator >>(CSBaseExpression lhs, int bits) { return(new CSBinaryExpression(CSBinaryOperator.RightShift, lhs, CSConstant.Val(bits))); }
public CSParameter(string type, string name, CSParameterKind parameterKind = CSParameterKind.None, CSConstant defaultValue = null) : this(new CSSimpleType(type), new CSIdentifier(name), parameterKind, defaultValue) { }