コード例 #1
0
        public AdjacentList <TargetT> Convert <TargetT>(
            Func <T, TargetT> converterFunction)
        {
            if (converterFunction == null)
            {
                throw new ArgumentNullException(nameof(converterFunction));
            }

            var convertedCollection = new AdjacentList <TargetT>();

            Convert(ref convertedCollection, converterFunction);

            return(convertedCollection);
        }
コード例 #2
0
        public void Convert <TargetT>(ref AdjacentList <TargetT>
                                      targetCollection, Func <T, TargetT> converterFunction)
        {
            if (targetCollection == null)
            {
                throw new ArgumentNullException(nameof(targetCollection));
            }
            if (converterFunction == null)
            {
                throw new ArgumentNullException(nameof(converterFunction));
            }

            targetCollection.Base  = converterFunction(Base);
            targetCollection.East  = converterFunction(East);
            targetCollection.West  = converterFunction(West);
            targetCollection.Above = converterFunction(Above);
            targetCollection.Below = converterFunction(Below);
            targetCollection.North = converterFunction(North);
            targetCollection.South = converterFunction(South);
        }