当前位置: 首页>>代码示例>>C#>>正文


C# System.SByte类代码示例

本文整理汇总了C#中System.SByte的典型用法代码示例。如果您正苦于以下问题:C# SByte类的具体用法?C# SByte怎么用?C# SByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SByte类属于System命名空间,在下文中一共展示了SByte类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSByte

		private static void TestSByte( SByte value )
		{
			var output = new MemoryStream();
			Packer.Create( output ).Pack( value );
			Assert.AreEqual( value, Unpacking.UnpackSByte( new MemoryStream( output.ToArray() ) ) );
			Assert.AreEqual( value, Unpacking.UnpackSByte( output.ToArray() ).Value );
		}
开发者ID:davemkirk,项目名称:msgpack-cli,代码行数:7,代码来源:DirectConversionTest.Scalar.cs

示例2: Test_SetDataTypesFromValue

    private static void Test_SetDataTypesFromValue()
    {
        CUBRIDParameter param = new CUBRIDParameter();
        param.ParameterName = "?p";

        Boolean b = true;
        param.Value = b;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_SHORT);

        SByte sb = new SByte();
        param.Value = sb;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_SHORT);

        Byte by = new Byte();
        param.Value = by;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_SHORT);

        Int16 i16 = 0;
        param.Value = i16;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_SHORT);

        UInt16 ui16 = 0;
        param.Value = ui16;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_SHORT);

        UInt32 ui32 = 0;
        param.Value = ui32;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_INT);

        Int64 i64 = 0;
        param.Value = i64;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_BIGINT);

        UInt64 ui64 = 0;
        param.Value = ui64;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_BIGINT);

        param.Value = DateTime.Now;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_DATETIME);

        string str = "cubrid";
        param.Value = str;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_STRING);

        Single sin = 0;
        param.Value = sin;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_FLOAT);

        Double dou = 0;
        param.Value = dou;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_DOUBLE);

        Decimal dec = 0;
        param.Value = dec;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_NUMERIC);

        DBNull n=null;
        param.Value = n;
        Debug.Assert(param.CUBRIDDataType == CUBRIDDataType.CCI_U_TYPE_NULL);
    }
开发者ID:CUBRID,项目名称:cubrid-adonet,代码行数:60,代码来源:TestCUBRIDParameters.cs

示例3: Serialize

        public override SByte[] Serialize(String data)
        {
            if (String.IsNullOrEmpty(data))
                return null;
            var totalLength = buildHead(data.Length, data);
            encodeData = new SByte[totalLength];
            var startX = 0;
            for (int i = 0; i < data.Length / 3; i++)
            {
                var value = Convert.ToString(Int32.Parse(data.Substring(startX, 3)), 2);
                value = Converter.SupplyZero(10, value);
                fillData(startX + headLength, value);
                startX += 3;
            }
            startX /= 3;
            var remainer = totalLength - startX * 10;
            if (remainer > 0)
            {
                var value = Convert.ToString(Int32.Parse(data.Substring(startX)), 2);
                value = Converter.SupplyZero(remainer, value);
                fillData(startX + headLength, value);
            }

            return encodeData;
        }
开发者ID:zformular,项目名称:ValueHelper,代码行数:25,代码来源:NumericSerializer.cs

示例4: encBytes

        public String encBytes(SByte[] barr)
        {
            StringBuilder licKey = new
              StringBuilder();
            for
              (int
              i = 0; i <= 15; i++)
            {
                SByte i1 = barr[i];
                int
             j = 0;
                j |= i1 & 0xFF;
                j %= 32;
                if
             (i > 0 && i % 4 == 0)
                {
                    licKey.Append("-"
               );
                }
                //  licKey = licKey.Append(Convert.ToChar(validChars.Substring(j, 1)));

            }
            // String licKey = Base64Utils.base64Encode(hash);

            return
              licKey.ToString();
        }
开发者ID:romanu6891,项目名称:fivemen,代码行数:27,代码来源:TestMd5.cs

示例5: Deserialize_V0

        public void Deserialize_V0(Stream stream, DataVersion version)
        {
            Byte[] buffer = new Byte[1];

            stream.Read(buffer, 0, 1);
            Value = (SByte)buffer[0];
        }
开发者ID:Digresiv,项目名称:garminworkouts,代码行数:7,代码来源:GarminFitnessSByteRange.cs

示例6: ReadSByteArray

 public static SByte[] ReadSByteArray(this ObjectReader reader)
 {
     var length = reader.ReadInt32();
     SByte[] value = new SByte[length];
     for(int i = 0; i < length; i++) value[i] = (SByte)reader.Stream.ReadByte();
     return value;
 }
开发者ID:glorylee,项目名称:Aoite,代码行数:7,代码来源:NumberFormatters~Integers.cs

示例7: ParseSByte_Test_1

        public MFTestResults ParseSByte_Test_1()
        {
            Log.Comment("SByte MinValue = " + SByte.MinValue.ToString());
            Log.Comment("SByte MaxValue = " + SByte.MaxValue.ToString());

            String[] strArr = GetRandomStringArray(SByte.MaxValue, true);
            SByte[] _sByte = new SByte[intArr.Length];
            for (int i = 0; i < _sByte.Length; i++)
            {
                _sByte[i] = (SByte)intArr[i];
            }

            int counter = 0;
            SByte temp = 0;
            for (int i = 0; i < strArr.Length; i++)
            {
                try
                {
                    temp = SByte.Parse(strArr[i]);
                }
                catch (Exception ex)
                {
                    Log.Comment(i.ToString() + " Caught : " + ex.Message + " when SByte.Parse('" + strArr[i] + "')");
                    counter++;
                }
                if (temp != _sByte[i])
                {
                    Log.Comment(i.ToString() + " Expecting " + _sByte[i] + " but got " + temp);
                    counter++;
                }
            }

            return (counter == 0) ? MFTestResults.Pass : MFTestResults.Fail;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:34,代码来源:ParseTests.cs

示例8: ToSByte

 public static SByte ToSByte(string valueToParse, SByte defaultValue)
 {
     SByte returnValue;
     if (!SByte.TryParse(valueToParse, out returnValue))
         returnValue = defaultValue;
     return returnValue;
 }
开发者ID:benjaminaaron,项目名称:SumoVizUnity_ModSem,代码行数:7,代码来源:TryParseWithDefault.cs

示例9: WorkOnInstanceAndLocal

	private void WorkOnInstanceAndLocal()
	{
		int localInt, i, j;
                for ( i = 0; i < 100; i++ )
                {
                   int index = randomNumGen.Next(0, ValueArraySize); 
		   instanceInt_1 = ValueArray[index];
                   Thread.Sleep(index);  
                   localInt = instanceInt_1; 
                   for ( j = 0; j < ValueArraySize; j++ )
                     if ( ValueArray[j] == localInt )
                          break;
                   if (j == ValueArraySize )
                     throw new Exception("WorkOnInstanceAndLocal: Atomicity of Read/Write violated - " + localInt);
                }	

		SByte localInt_1;
		localInt_1 = 1 + 1;
		if(localInt_1 != 2)
			throw new Exception("Loc_7453fg! Major Error here");
		localInt_1 = SByte.MaxValue + SByte.MinValue;
		if(localInt_1 != -1)
			throw new Exception("Loc_98745sg! Major Error here");
		localInt_1 = 50 * 2;
		if(localInt_1 != 100)
			throw new Exception("Loc_3975sg! Major Error here, " + localInt_1);
		localInt_1 = SByte.Parse("32");
		if(localInt_1 != 32)
			throw new Exception("Loc_975esg! Major Error here, " + localInt_1);
		localInt_1 = SByte.MaxValue;
		if(localInt_1.GetHashCode() != 32639)
			throw new Exception("Loc_07245sg! Major Error here, " + localInt_1.GetHashCode());
		if(localInt_1.ToString() != "127")
			throw new Exception("Loc_834sgd! Major Error here, " + localInt_1.ToString());
	}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:35,代码来源:co8547sbyte.cs

示例10: GarminFitnessSByteRange

        public GarminFitnessSByteRange(SByte value, SByte min, SByte max)
        {
            m_MinimumValue = Math.Min(min, max);
            m_MaximumValue = Math.Max(min, max);

            Value = value;
        }
开发者ID:Digresiv,项目名称:garminworkouts,代码行数:7,代码来源:GarminFitnessSByteRange.cs

示例11: Init

			public override void Init(MapMemberInfo mapMemberInfo)
			{
				if (mapMemberInfo == null) throw new ArgumentNullException("mapMemberInfo");

				_nullValue = Convert.ToSByte(mapMemberInfo.NullValue);

				base.Init(mapMemberInfo);
			}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:8,代码来源:MemberMapper.generated.cs

示例12: Abs

 public static object Abs(SByte x) {
     if (x < 0) {
         if (x == SByte.MinValue) return -(Int16)SByte.MinValue;
         else return (SByte)(-x);
     } else {
         return x;
     }
 }
开发者ID:jschementi,项目名称:iron,代码行数:8,代码来源:IntOps.Generated.cs

示例13: TestSByte

		private static void TestSByte( SByte value )
		{
			var output = new MemoryStream();
			Packer.Create( output ).Pack( value );
			var mpo = UnpackOne( output );
			Assert.AreEqual( value, ( SByte )mpo );
			Assert.AreEqual( value, mpo.AsSByte() );
		}
开发者ID:eslo,项目名称:msgpack-cli,代码行数:8,代码来源:PackUnpackTest.Scalar.cs

示例14: TestCtor

    public static void TestCtor()
    {
        SByte i = new SByte();
        Assert.True(i == 0);

        i = 41;
        Assert.True(i == 41);
    }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:SByte.cs

示例15: ScanResponseEventArgs

		public ScanResponseEventArgs (SByte rssi, Byte packet_type, Byte[] sender, Byte address_type, Byte bond, Byte[] data)
		{
			this.rssi = rssi;
			this.packet_type = packet_type;
			this.sender = sender;
			this.address_type = address_type;
			this.bond = bond;
			this.data = data;
		}
开发者ID:jedinja,项目名称:monomyo,代码行数:9,代码来源:ScanResponseEventArgs.cs


注:本文中的System.SByte类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。