CSharpUML.UmlMethod.Matches C# (CSharp) Метод

Matches() публичный статический Метод

public static Matches ( CSharpBlock block ) : bool
block CSharpBlock
Результат bool
        public static bool Matches(CSharpBlock block)
        {
            string line = block.Name;

            // index operator?
            if (line.Contains ("this [") && line.Contains ("]")) {
                return true;
            }

            // normal method?
            int indexBracketOpen = line.IndexOf ("(");
            int indexBracketClose = line.IndexOf (")");
            int indexEqualSign = line.IndexOf ("=");
            if (indexBracketOpen != -1 && indexBracketClose != -1) {
                if (indexEqualSign == -1) {
                    return true;
                } else if (indexBracketOpen < indexEqualSign && indexBracketClose > indexEqualSign) {
                    return true;
                }
            }
            return false;
        }

Same methods

UmlMethod::Matches ( UmlBlock block ) : bool

Usage Example

Пример #1
0
 public IEnumerable <IUmlObject> ParseContent(IEnumerable <UmlBlock> blocks)
 {
     foreach (UmlBlock subblock in blocks)
     {
         if (UmlClass.Matches(subblock))
         {
             yield return(new UmlClass(subblock));
         }
         else if (UmlEnum.Matches(subblock))
         {
             yield return(new UmlEnum(subblock));
         }
         else if (UmlMethod.Matches(subblock))
         {
             yield return(new UmlMethod(subblock, this));
         }
         else if (UmlAttribute.Matches(subblock))
         {
             yield return(new UmlAttribute(subblock, this));
         }
     }
 }