Bind.FuncProcessor.MarkCLSCompliance C# (CSharp) Method

MarkCLSCompliance() static private method

static private MarkCLSCompliance ( FunctionCollection collection ) : FunctionCollection
collection FunctionCollection
return FunctionCollection
        static FunctionCollection MarkCLSCompliance(FunctionCollection collection)
        {
            //foreach (var w in
            //    (from list in collection
            //    from w1 in list.Value
            //    from w2 in list.Value
            //    where 
            //        w1.TrimmedName == w2.TrimmedName &&
            //        w1.Parameters.Count == w2.Parameters.Count &&
            //        ParametersDifferOnlyInReference(w1.Parameters, w2.Parameters)
            //    select !w1.Parameters.HasReferenceParameters ? w1 : w2))
            //    {
            //        results.Add(w);
            //    }

            foreach (List<Function> wrappers in collection.Values)
            {
                restart:
                for (int i = 0; i < wrappers.Count; i++)
                {
                    for (int j = i + 1; j < wrappers.Count; j++)
                    {
                        if (wrappers[i].TrimmedName == wrappers[j].TrimmedName && wrappers[i].Parameters.Count == wrappers[j].Parameters.Count)
                        {
                            bool function_i_is_problematic = false;
                            bool function_j_is_problematic = false;

                            int k;
                            for (k = 0; k < wrappers[i].Parameters.Count; k++)
                            {
                                if (wrappers[i].Parameters[k].CurrentType != wrappers[j].Parameters[k].CurrentType)
                                    break;

                                if (wrappers[i].Parameters[k].DiffersOnlyOnReference(wrappers[j].Parameters[k]))
                                if (wrappers[i].Parameters[k].Reference)
                                    function_i_is_problematic = true;
                                else
                                    function_j_is_problematic = true;
                            }

                            if (k == wrappers[i].Parameters.Count)
                            {
                                if (function_i_is_problematic)
                                    wrappers.RemoveAt(i);
                                //wrappers[i].CLSCompliant = false;
                                if (function_j_is_problematic)
                                    wrappers.RemoveAt(j);
                                //wrappers[j].CLSCompliant = false;

                                if (function_i_is_problematic || function_j_is_problematic)
                                    goto restart;
                            }
                        }
                    }
                }
            }
            return collection;
        }