本文整理汇总了C#中Int16类的典型用法代码示例。如果您正苦于以下问题:C# Int16类的具体用法?C# Int16怎么用?C# Int16使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Int16类属于命名空间,在下文中一共展示了Int16类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Write
public override void Write(Int16 val)
{
val = Utilities.SwapBytes(val);
base.Write(val);
if (AutoFlush) Flush();
}
开发者ID:svarogg,项目名称:System.Drawing.PSD,代码行数:7,代码来源:BinaryReverseWriter.cs
示例2: Channel
internal Channel(Int16 id, Layer layer)
{
ID = id;
Layer = layer;
Layer.Channels.Add(this);
Layer.SortedChannels.Add(ID, this);
}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:7,代码来源:LayerChannel.cs
示例3: BigEndian
/// <summary>
/// Converts a <see cref="Int16"/> to big endian notation.
/// </summary>
/// <param name="input">The <see cref="Int16"/> to convert.</param>
/// <returns>The converted <see cref="Int16"/>.</returns>
public static Int16 BigEndian(Int16 input)
{
if (!BitConverter.IsLittleEndian)
return input;
return Swap(input);
}
开发者ID:neokamikai,项目名称:rolib,代码行数:12,代码来源:EndianConverter.cs
示例4: Document
public Document(
Int16 _TypeId,
Int64 _Serial,
Int32 _SignedUser,
DateTime _Date,
Boolean _Printed,
String _DocumentShortName,
String _DocumentFullName,
String _MedexDataTable,
String _DocumentBody,
String _DocumentHeader,
Boolean _SetDeleted
)
{
TypeId = _TypeId;
Serial = _Serial;
SignedUser = _SignedUser;
Date = _Date;
Printed = _Printed;
DocumentShortName = _DocumentShortName;
DocumentFullName = _DocumentFullName;
MedexDataTable = _MedexDataTable;
DocumentBody = _DocumentBody;
DocumentHeader = _DocumentHeader;
SetDeleted = _SetDeleted;
}
开发者ID:oeai,项目名称:medx,代码行数:27,代码来源:Document.cs
示例5: VerifyInt16ImplicitCastToComplex
private static void VerifyInt16ImplicitCastToComplex(Int16 value)
{
Complex c_cast = value;
if (false == Support.VerifyRealImaginaryProperties(c_cast, value, 0.0))
{
Console.WriteLine("Int16ImplicitCast ({0})" + value);
Assert.True(false, "Verification Failed");
}
else
{
if (value != Int16.MaxValue)
{
Complex c_cast_plus = c_cast + 1;
if (false == Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0))
{
Console.WriteLine("PLuS + Int16ImplicitCast ({0})" + value);
Assert.True(false, "Verification Failed");
}
}
if (value != Int16.MinValue)
{
Complex c_cast_minus = c_cast - 1;
if (false == Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0))
{
Console.WriteLine("Minus - Int16ImplicitCast + 1 ({0})" + value);
Assert.True(false, "Verification Failed");
}
}
}
}
开发者ID:gitter-badger,项目名称:corefx,代码行数:32,代码来源:implicitExplicitCastOperators.cs
示例6: Int16
public static byte[] Int16(Int16 i, Endianness e = Endianness.Machine)
{
byte[] bytes = BitConverter.GetBytes(i);
if (NeedsFlipping(e)) Array.Reverse(bytes);
return bytes;
}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:8,代码来源:Pack.cs
示例7: Write
public static void Write(this BinaryWriter writer, Int16 value, bool invertEndian = false)
{
if (invertEndian)
{
writer.WriteInvertedBytes(BitConverter.GetBytes(value));
}
else
{
writer.Write(value);
}
}
开发者ID:r2d2rigo,项目名称:BinaryEndiannessExtensions,代码行数:11,代码来源:BinaryWriterExtensions.cs
示例8: VerifyInt16ImplicitCastToComplex
private static void VerifyInt16ImplicitCastToComplex(Int16 value)
{
Complex c_cast = value;
Support.VerifyRealImaginaryProperties(c_cast, value, 0.0,
string.Format("Int16ImplicitCast ({0})", value));
if (value != Int16.MaxValue)
{
Complex c_cast_plus = c_cast + 1;
Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0,
string.Format("PLuS + Int16ImplicitCast ({0})", value));
}
if (value != Int16.MinValue)
{
Complex c_cast_minus = c_cast - 1;
Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0,
string.Format("Minus - Int16ImplicitCast + 1 ({0})", value));
}
}
开发者ID:noahfalk,项目名称:corefx,代码行数:21,代码来源:implicitExplicitCastOperators.cs
示例9: WriteArray
public override void WriteArray(string prefix, string localName, string namespaceUri, Int16[] array, int offset, int count)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.JsonWriteArrayNotSupported)));
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:4,代码来源:XmlJsonWriter.cs
示例10: TryToInt16
internal static Exception TryToInt16(string s, out Int16 result) {
if (!Int16.TryParse(s, NumberStyles.AllowLeadingSign|NumberStyles.AllowLeadingWhite|NumberStyles.AllowTrailingWhite, NumberFormatInfo.InvariantInfo, out result)) {
return new FormatException(Res.GetString(Res.XmlConvert_BadFormat, s, "Int16"));
}
return null;
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:XmlConvert.cs
示例11: VerifyInt16ImplicitCastToBigInteger
private static void VerifyInt16ImplicitCastToBigInteger(Int16 value)
{
BigInteger bigInteger = value;
Assert.Equal(value, bigInteger);
Assert.Equal(value.ToString(), bigInteger.ToString());
Assert.Equal(value, (Int16)bigInteger);
if (value != Int16.MaxValue)
{
Assert.Equal((Int16)(value + 1), (Int16)(bigInteger + 1));
}
if (value != Int16.MinValue)
{
Assert.Equal((Int16)(value - 1), (Int16)(bigInteger - 1));
}
VerifyBigIntegerUsingIdentities(bigInteger, 0 == value);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:cast_to.cs
示例12: Write
public void Write(Int16[] value, int offset, int count)
{
const int size = sizeof(Int16);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
开发者ID:iPhoneRetro,项目名称:wiiuhackingteam,代码行数:12,代码来源:EndianBinaryWriter.cs
示例13: Int16ToBytes
/// <summary>
/// Converts int16 to the array of bytes size 2
/// </summary>
/// <param name="value">Int16 value</param>
/// <returns>Array of bytes of size 2.</returns>
public static byte[] Int16ToBytes(Int16 value)
{
return Int32ToBytes(value, 2);
}
开发者ID:kapryeong,项目名称:HTTP-SPEED-PLUS-MOBILITY,代码行数:9,代码来源:BinaryHelper.cs
示例14: WriteArray
public override void WriteArray(string prefix, string localName, string namespaceUri, Int16[] array, int offset, int count)
{
throw new NotSupportedException(SR.JsonWriteArrayNotSupported);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:4,代码来源:XmlJsonWriter.cs
示例15: Push
public void Push(Int16 value)
{
Data[StackIndex++] = value;
}
开发者ID:Corillian,项目名称:corefx,代码行数:4,代码来源:InterpretedFrame.cs
示例16: SetInt16
// valid for SqlDbType.SmallInt
internal void SetInt16(Int16 value)
{
Debug.Assert(
SmiXetterAccessMap.IsSetterAccessValid(_metaData, SmiXetterTypeCode.XetInt16));
if (SqlDbType.Variant == _metaData.SqlDbType)
{
_stateObj.Parser.WriteSqlVariantHeader(4, TdsEnums.SQLINT2, 0, _stateObj);
}
else
{
_stateObj.WriteByte((byte)_metaData.MaxLength);
}
_stateObj.Parser.WriteShort(value, _stateObj);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:16,代码来源:TdsValueSetter.cs
示例17: ConvertInt16ByrefToPtr
internal static unsafe IntPtr ConvertInt16ByrefToPtr(ref Int16 value) {
fixed (Int16 *x = &value) {
AssertByrefPointsToStack(new IntPtr(x));
return new IntPtr(x);
}
}
开发者ID:jcteague,项目名称:ironruby,代码行数:6,代码来源:ComRuntimeHelpers.cs
示例18: VerifyInt16ExplicitCastFromBigInteger
private static void VerifyInt16ExplicitCastFromBigInteger(Int16 value, BigInteger bigInteger)
{
Assert.Equal(value, (Int16)bigInteger);
}
开发者ID:er0dr1guez,项目名称:corefx,代码行数:4,代码来源:cast_from.cs
示例19: ADCResultEventArgs
public ADCResultEventArgs(Byte input, Int16 value)
{
this.input = input;
this.value = value;
}
开发者ID:hstdesigns,项目名称:htw_projects,代码行数:5,代码来源:BGLib.cs
示例20: ReadArray
private unsafe int ReadArray(Int16[] array, int offset, int count)
{
CheckArray(array, offset, count);
int actual = Math.Min(count, _arrayCount);
fixed (Int16* items = &array[offset])
{
BufferReader.UnsafeReadArray((byte*)items, (byte*)&items[actual]);
}
SkipArrayElements(actual);
return actual;
}
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:XmlBinaryReader.cs
注:本文中的Int16类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论