这个语句有什么错误啊,operator该如何使用?
msdn上有教程。
C# 程序员参考  
运算符(C# 参考)  
operator 关键字用于在类或结构声明中声明运算符。运算符声明可以采用下列四种形式之一:
public static result-type operator unary-operator ( op-type operand )
public static result-type operator binary-operator (
      op-type operand,
      op-type2 operand2
)
public static implicit operator conv-type-out ( conv-type-in operand )
public static explicit operator conv-type-out ( conv-type-in operand )
参数
result-type 
运算符的结果类型。
unary-operator 
下列运算符之一:+   -   !   ~   ++   —   true   false
op-type 
第一个(或唯一一个)参数的类型。
operand 
第一个(或唯一一个)参数的名称。
binary-operator 
其中一个:+   -   *   /   %   &   |   ^   <<   >>   ==   !=   >   <   >=   <=
op-type2 
第二个参数的类型。
operand2 
第二个参数的名称。
conv-type-out 
类型转换运算符的目标类型。
conv-type-in 
类型转换运算符的输入类型。
备注
前两种形式声明了用户定义的重载内置运算符的运算符。注意,并非所有内置运算符都可以被重载(请参见可重载的运算符)。op-type 和 op-type2 中至少有一个必须是封闭类型(即运算符所属的类型)。例如,这将防止重定义整数加法运算符。
后两种形式声明了转换运算符。conv-type-in 和 conv-type-out 中正好有一个必须是封闭类型(即,转换运算符只能从它的封闭类型转换为其他某个类型,或从其他某个类型转换为它的封闭类型)。
运算符只能采用值参数,不能采用 ref 或 out 参数。
任何运算符声明的前面都可以有一个可选的属性(C# 编程指南)列表。
示例
以下是一个有理数的极其简化的类。该类重载 + 和 * 运算符以执行小数加法和乘法,同时提供将小数转换为双精度的运算符。
// cs_keyword_operator.cs
using System;
class Fraction
{
    int num, den;
    public Fraction(int num, int den)
    {
        this.num = num;
        this.den = den;
    }
    // overload operator +
    public static Fraction operator +(Fraction a, Fraction b)
    {
        return new Fraction(a.num * b.den + b.num * a.den,
           a.den * b.den);
    }
    // overload operator *
    public static Fraction operator *(Fraction a, Fraction b)
    {
        return new Fraction(a.num * b.num, a.den * b.den);
    }
    // define operator double
    public static implicit operator double(Fraction f)
    {
        return (double)f.num / f.den;
    }
}
class Test
{
    static void Main()
    {
        Fraction a = new Fraction(1, 2);
        Fraction b = new Fraction(3, 7);
        Fraction c = new Fraction(2, 3);
        Console.WriteLine((double)(a * b + c));
    }
}
输出
0.880952380952381



 
											






 
	    

 
	



