コード例 #1
0
        public static VisitResult Construct <TDstContainer, TSrcContainer>(ref TDstContainer dstContainer, ref TSrcContainer srcContainer, PropertyContainerConstructOptions options = default)
        {
            if (!RuntimeTypeInfoCache <TSrcContainer> .IsValueType() && srcContainer == null)
            {
                throw new ArgumentNullException(nameof(srcContainer));
            }

            if (!RuntimeTypeInfoCache <TDstContainer> .IsValueType() && dstContainer == null)
            {
                if (typeof(UnityEngine.Object).IsAssignableFrom(typeof(TDstContainer)))
                {
                    throw new ArgumentNullException(nameof(dstContainer));
                }

                if (!TypeConstruction.TryConstruct(srcContainer.GetType(), out dstContainer))
                {
                    throw new ArgumentNullException(nameof(dstContainer));
                }
            }

            var result = VisitResult.GetPooled();

            Construct(ref dstContainer, ref srcContainer, result, options);
            return(result);
        }
コード例 #2
0
        public static VisitResult Transfer <TDstContainer, TSrcContainer>(ref TDstContainer dstContainer, ref TSrcContainer srcContainer)
        {
            if (!RuntimeTypeInfoCache <TDstContainer> .IsValueType() && dstContainer == null)
            {
                throw new ArgumentNullException(nameof(dstContainer));
            }

            var result = VisitResult.GetPooled();

            Transfer(ref dstContainer, ref srcContainer, result);
            return(result);
        }