本文整理汇总了C#中LineInfo.getLineClass方法的典型用法代码示例。如果您正苦于以下问题:C# LineInfo.getLineClass方法的具体用法?C# LineInfo.getLineClass怎么用?C# LineInfo.getLineClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineInfo
的用法示例。
在下文中一共展示了LineInfo.getLineClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: matches
/// <summary>Indicates whether the specified info object matches this one.</summary>
/// <remarks>
/// Indicates whether the specified info object matches this one.
/// To match, the specified object must be identical to or
/// a special case of this one. The specified info object
/// must be either an instance of the same class as this one,
/// or an instance of a sub-type of this one. In addition, the
/// attributes of the specified object must be compatible with the
/// capabilities of this one. Specifically, the routing configuration
/// for the specified info object must be compatible with that of this
/// one.
/// Subclasses may add other criteria to determine whether the two objects
/// match.
/// </remarks>
/// <param name="info">the info object which is being compared to this one</param>
/// <returns>
/// <code>true</code> if the specified object matches this one,
/// <code>false</code> otherwise
/// </returns>
public virtual bool matches(LineInfo info)
{
// $$kk: 08.30.99: is this backwards?
// dataLine.matches(targetDataLine) == true: targetDataLine is always dataLine
// targetDataLine.matches(dataLine) == false
// so if i want to make sure i get a targetDataLine, i need:
// targetDataLine.matches(prospective_match) == true
// => prospective_match may be other things as well, but it is at least a targetDataLine
// targetDataLine defines the requirements which prospective_match must meet.
// "if this Class object represents a declared class, this method returns
// true if the specified Object argument is an instance of the represented
// class (or of any of its subclasses)"
// GainControlClass.isInstance(MyGainObj) => true
// GainControlClass.isInstance(MySpecialGainInterfaceObj) => true
// this_class.isInstance(that_object) => that object can by cast to this class
// => that_object's class may be a subtype of this_class
// => that may be more specific (subtype) of this
// "If this Class object represents an interface, this method returns true
// if the class or any superclass of the specified Object argument implements
// this interface"
// GainControlClass.isInstance(MyGainObj) => true
// GainControlClass.isInstance(GenericControlObj) => may be false
// => that may be more specific
if (!(info is Line))
{
return false;
}
// this.isAssignableFrom(that) => this is same or super to that
// => this is at least as general as that
// => that may be subtype of this
if (!(getLineClass().IsAssignableFrom(info.getLineClass())))
{
return false;
}
return true;
}