コード例 #1
0
        /// <summary>
        /// Adds an element to the container.
        /// </summary>
        /// <typeparam name="T">Source type of elements.</typeparam>
        /// <param name="value">The struct to be added at the end of the container.</param>
        public void Add <T>(T value) where T : struct
        {
            var structSize = UnsafeUtility.SizeOf <T>();

            SetCapacity(Length + structSize);
            UnsafeUtility.CopyStructureToPtr(ref value, Ptr + Length);
            Length += structSize;
        }
コード例 #2
0
        public void Add <T>(T t) where T : struct
        {
            var structSize = UnsafeUtility.SizeOf <T>();

            SetCapacity(Size + structSize);
            UnsafeUtility.CopyStructureToPtr(ref t, Ptr + Size);
            Size += structSize;
        }