コード例 #1
0
ファイル: DataStream.cs プロジェクト: conankzhang/fez
 public unsafe void Write <T>(T value) where T : struct
 {
     if (!this._canWrite)
     {
         throw new NotSupportedException();
     }
     this._position = (sbyte *)(void *)Utilities.WriteAndPosition <T>((IntPtr)((void *)(this._buffer + this._position)), ref value) - this._buffer;
 }
コード例 #2
0
 /// <summary>
 ///   Writes a single value to the stream, and advances the current position
 ///   within this stream by the number of bytes written.
 /// </summary>
 /// <remarks>
 /// In order to provide faster read/write, this operation doesn't check stream bound.
 /// A client must carefully not read/write above the size of this datastream.
 /// </remarks>
 /// <typeparam name = "T">The type of the value to be written to the stream.</typeparam>
 /// <param name = "value">The value to write to the stream.</param>
 /// <exception cref = "T:System.NotSupportedException">The stream does not support writing.</exception>
 public void Write <T>(T value) where T : struct
 {
     if (!_canWrite)
     {
         throw new NotSupportedException();
     }
     unsafe
     {
         _position = (sbyte *)Utilities.WriteAndPosition((IntPtr)(_buffer + _position), ref value) - _buffer;
     }
 }