예제 #1
0
            private static int SequenceNumber(MethodSymbol method)
            {
                // return a unique sequence number for the async implementation class that is independent of the compilation state.
                int count = 0;
                foreach (var m in method.ContainingNamespaceOrType().GetMembers(method.Name))
                {
                    count++;
                    if (method == m) return count;
                }

                // It is possible we did not find any such members, e.g. for methods that result from the translation of
                // async lambdas.  In that case the method has already been uniquely named, so there is no need to
                // produce a unique sequence number for the corresponding class, which already includes the (unique) method name.
                return count;
            }