예제 #1
0
        private IEnumerable <PairedMembers> FindPairs()
        {
            IEnumerable <IMember> fromAll = this.GetFromMembers(this.aFrom);
            IEnumerable <IMember> toAll   = this.GetToMembers(this.aTo);

            foreach (IMember fromOne in fromAll)
            {
                var  foundMembers = new List <(Found Found, IMember Member)>();
                bool foundFull    = false;

                foreach (IMember toOne in toAll)
                {
                    PairedMembers pair = this.DetectPair(fromOne, toOne);

                    if (pair != null)
                    {
                        foundFull = true;

                        yield return(pair);

                        break;
                    }
                    else if (fromOne.Symbol.HasPrefix(toOne.Symbol) && !BasicNetTypes.IsPrimitiveOrPrimitiveLikeType(toOne.Type))
                    {
                        foundMembers.Add((Found.Left, toOne));
                    }
                    else if (toOne.Symbol.HasPrefix(fromOne.Symbol) && !BasicNetTypes.IsPrimitiveOrPrimitiveLikeType(fromOne.Type))
                    {
                        foundMembers.Add((Found.Right, toOne));
                    }
                }

                if (!foundFull)
                {
                    foreach (var foundMember in foundMembers)
                    {
                        if (foundMember.Found == Found.Left)
                        {
                            PairedMembers pair = this.DetectPairLeft(fromOne, foundMember.Member, foundMember.Member.Symbol);
                            if (pair != null)
                            {
                                yield return(pair);

                                break;
                            }
                        }
                        else
                        {
                            PairedMembers pair = this.DetectPairRight(fromOne, foundMember.Member, fromOne.Symbol);
                            if (pair != null)
                            {
                                yield return(pair);

                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
 public bool IsPrimitiveOrPrimitiveLike <TPlaceholder>() where TPlaceholder : GenericParameter
 => BasicNetTypes.IsPrimitiveOrPrimitiveLikeType(this.Type <TPlaceholder>());