コード例 #1
0
        private static void AddWorkToQueue(
            ITypeSymbol candidateType,
            IEnumerable <string> disposableMembers,
            ICollection <DisposeWork> workToDo)
        {
            var work = new DisposeWork
            {
                NamespaceName         = candidateType.ContainingNamespace.ToString(),
                ClassName             = candidateType.Name,
                DeclaredAccessibility = candidateType.DeclaredAccessibility.ToString(),

                DisposableMemberNames = disposableMembers,

                // Do I have a DisposeManaged member method? Call it.
                ImplementManaged = candidateType.ContainsCustomDisposer("DisposeManaged"),

                // Do I have a DisposeUnmanaged member method? Call it.
                ImplementUnmanaged = candidateType.ContainsCustomDisposer("DisposeUnmanaged"),
            };

            workToDo.Add(work);
        }