本文整理汇总了C#中Operators类的典型用法代码示例。如果您正苦于以下问题:C# Operators类的具体用法?C# Operators怎么用?C# Operators使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Operators类属于命名空间,在下文中一共展示了Operators类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Condition
public Condition(bool not, string key, Operators opt, params object[] values)
{
Key = key;
Operate = opt;
Values = values;
Not = not;
}
示例2: TransformSet
internal override MSAst.Expression TransformSet(AstGenerator ag, SourceSpan span, MSAst.Expression right, Operators op) {
if (op == Operators.None) {
return ag.AddDebugInfoAndVoid(
Binders.Set(
ag.BinderState,
typeof(object),
SymbolTable.IdToString(_name),
ag.Transform(_target),
right
),
span
);
} else {
MSAst.ParameterExpression temp = ag.GetTemporary("inplace");
return ag.AddDebugInfo(
Ast.Block(
Ast.Assign(temp, ag.Transform(_target)),
SetMemberOperator(ag, right, op, temp),
Ast.Empty()
),
Span.Start,
span.End
);
}
}
示例3: Rule
public Rule(Operators operand, string to, string operandOne, string operandTwo)
{
this.Operation = operand;
this.To = to;
this.First = operandOne;
this.Second = operandTwo;
}
示例4: TransformSet
internal override MSAst.Expression TransformSet(AstGenerator ag, SourceSpan span, MSAst.Expression right, Operators op) {
MSAst.Expression variable = _reference.Variable;
MSAst.Expression assignment;
Type vt = variable != null ? variable.Type : typeof(object);
if (op != Operators.None) {
right = Binders.Operation(
ag.BinderState,
vt,
StandardOperators.FromOperator(op),
Transform(ag, vt),
right
);
}
if (variable != null) {
assignment = AstUtils.Assign(variable, AstGenerator.ConvertIfNeeded(right, variable.Type));
} else {
assignment = AstUtils.Assign(_name, right);
}
SourceSpan aspan = span.IsValid ? new SourceSpan(Span.Start, span.End) : SourceSpan.None;
return ag.AddDebugInfoAndVoid(assignment, aspan);
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState.Clear();
this.result = 0;
ViewState.Add("result", this.result);
this.currentOperator = Operators.Plus;
ViewState.Add("operator", this.currentOperator);
ViewState.Add("currentNumber", string.Empty);
}
else
{
this.result = (decimal)ViewState["result"];
if (ViewState["operator"] != null)
{
this.currentOperator = (Operators)ViewState["operator"];
}
if (ViewState["currentNumber"] != null)
{
this.currentNumber = (string)ViewState["currentNumber"];
}
}
}
示例6: Expression
public Expression(Expression ex, Expression e2, Operators op)
{
Ex1 = ex;
Ex2 = e2;
Oper = op;
IsValue = false;
}
示例7: FloatCondition
public FloatCondition(string conditionVariable, Operators conditionOperator, float baseValue, bool absolute = false)
{
this.conditionVariable = conditionVariable;
this.conditionOperator = conditionOperator;
this.baseValue = baseValue;
this.absolute = absolute;
}
示例8: QuerySpecific
private static async void QuerySpecific(string field, object value, Operators op)
{
Console.WriteLine("Finding all the entries where {0} equals {1}...", field, value);
var collection = database.GetCollection<BsonDocument>(collectionName);
var builder = Builders<BsonDocument>.Filter;
FilterDefinition<BsonDocument> filter = null;
switch (op)
{
case Operators.Equals:
default:
filter = builder.Eq(field, value);
break;
case Operators.LessThan:
filter = builder.Lt(field, value);
break;
case Operators.GreaterThan:
filter = builder.Gt(field, value);
break;
case Operators.LessThanEqual:
filter = builder.Lte(field, value);
break;
case Operators.GreaterThanEqual:
filter = builder.Gte(field, value);
break;
}
var result = await collection.Find(filter).ToListAsync();
Console.WriteLine("There are {0} entries.", result.Count);
}
示例9: DoOperation
public void DoOperation(Operators @operator, int operand)
{
Executor command = new Executor(_calculator, @operator, operand);
command.Execute();
_index = _entries.Count;
_index++;
_entries.Add(command);
}
示例10: TransformSet
internal override MSAst.Expression TransformSet(AstGenerator ag, SourceSpan span, MSAst.Expression right, Operators op) {
if (Items.Length == 0) {
ag.AddError("can't assign to ()", Span);
return null;
}
return base.TransformSet(ag, span, right, op);
}
示例11: FromOperator
public static string FromOperator(Operators op) {
switch(op) {
case Operators.Equals: return "Equal";
case Operators.NotEquals: return "NotEqual";
default:
return op.ToString();
}
}
示例12: GetOpposite
private Operators GetOpposite(Operators @operator)
{
switch (@operator)
{
case Operators.Add: return Operators.Rest;
case Operators.Rest: return Operators.Add;
case Operators.Mult: return Operators.Div;
default: return Operators.Mult;
}
}
示例13: GetSymbol
private char GetSymbol(Operators @operator)
{
switch (@operator)
{
case Operators.Add: return '+';
case Operators.Rest: return '-';
case Operators.Mult: return '*';
default: return '/';
}
}
示例14: BuildConditionFromXML
private void BuildConditionFromXML(XmlElement xmlElement)
{
try
{
this.FieldName = xmlElement.GetAttribute("Field");
this.comparisionOperator = (Operators)Enum.Parse(typeof(Operators), xmlElement.GetAttribute("Operator"));
this.strValue = xmlElement.GetAttribute("Value");
this.comparisionType = (ConditionComparisionType)Enum.Parse(typeof(ConditionComparisionType), xmlElement.GetAttribute("ComparisionType"));
}
catch { }
}
示例15: FilterExpression
internal FilterExpression(object left, object right, Operators op)
{
Left = left as FilterExpression;
Right = right as FilterExpression;
LeftColumn = left as Column;
RightColumn = right as Column;
Value = Right == null && ReferenceEquals(RightColumn, null) ? right : null;
Operator = op;
if (AndOr && (Left == null || Right == null)) // should never happen but just in case
throw new Exception("All/Or expressions only act on two other FilterExpressions");
}