Unlimited Technique          Unlimited Wisdom

1001010000101001000010010001000010000101101110111 1101010010010101011110010101110101011010101010101

导航

Checking CallingClass type (waiting resolving)

 

CallingClass is the type of a class containing the method or property. When its value is not “any”, the match method of the CallingClass must be following code:

 public bool Match(Type type)

 {

      if (typeof(Any) == m_type)

          return true;

      else

{

          if (type != null && m_type != null)

              return (type.Name.Equals(m_type.Name));

          else

              return type.Equals(m_type);

}

 }

 

     Others has another expression:

 

public bool Match(Type type)

{

    if (typeof(Any) == m_type)

  return true;

    else

        return type.Equals(m_type);

}

 

     Why must the first code segment use type.name to check whether they are different?

posted on 2005-08-15 15:25  bughole  阅读(207)  评论(0)    收藏  举报