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


C# Byte.ToString方法代码示例

本文整理汇总了C#中System.Byte.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Byte.ToString方法的具体用法?C# Byte.ToString怎么用?C# Byte.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Byte的用法示例。


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

示例1: Main

        static void Main(string[] args)
        {
            string data = "";
            byte[] sendBytes = new Byte[1024];
            byte[] rcvPacket = new Byte[1024];
            UdpClient client = new UdpClient();
            IPAddress address = IPAddress.Parse(IPAddress.Broadcast.ToString());
            client.Connect(address, 8008);
            IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, 0);

            Console.WriteLine("Client is Started");
            Console.WriteLine("Type your message");

            while (data != "q")
            {
                data = Console.ReadLine();
                sendBytes = Encoding.ASCII.GetBytes(DateTime.Now.ToString() + " " + data);
                client.Send(sendBytes, sendBytes.GetLength(0));
                rcvPacket = client.Receive(ref remoteIPEndPoint);

                string rcvData = Encoding.ASCII.GetString(rcvPacket);
                Console.WriteLine("Handling client at " + remoteIPEndPoint + " - ");

                Console.WriteLine("Message Received: " + rcvPacket.ToString());
            }
            Console.WriteLine("Close Port Command Sent");  //user feedback
            Console.ReadLine();
            client.Close();  //close connection
        }
开发者ID:jonathankellermann,项目名称:UDP_Client,代码行数:29,代码来源:Program.cs

示例2: ClearFanCtrlData

 /// <summary>
 /// Clears all historical control data (i.e. power on/off) associated with a numbered fan.
 /// </summary>
 /// <param name="fanNumber">Numbered fan to clear historical data from.</param>
 /// <returns>Asynchronous Processing Task.</returns>
 public async Task ClearFanCtrlData(Byte fanNumber)
 {
     //Call Worker.
     await RESTWorker("/MooseBox/API/v1.0/peripherals/fan/data/clear",
                      Method.DELETE,
                      restRequest => { restRequest.AddQueryParameter(ParamFanNumber, fanNumber.ToString()); });
 }
开发者ID:ChristopherJCavage,项目名称:MooseBox,代码行数:12,代码来源:MooseBoxRESTAPI_v1_0.cs

示例3: CheckByte

 public void CheckByte(Byte value, string format)
 {
     var parsed = Format.Parse(format);
     var formatter = new StringFormatter(pool);
     formatter.Append(value, parsed);
     var result = formatter.ToString();
     var clrResult = value.ToString(format, CultureInfo.InvariantCulture);
     Assert.Equal(clrResult, result);
 }
开发者ID:geoffkizer,项目名称:corefxlab,代码行数:9,代码来源:NumberFormattingTests.Generated.cs

示例4: Main

        static void Main(string[] args)
        {
            if (args.Length > 1)
                throw new ArgumentException("Params : <[Port]>");
            int servPort = (args.Length == 1) ? Int32.Parse(args[0]) : 2500;
            TcpListener listner = null;

            try
            {
                listner = new TcpListener(IPAddress.Any, servPort);
                listner.Start();
                Console.WriteLine("Waiting for a connection ..... ");
            }
            catch (SocketException e)
            {
                Console.WriteLine(e.ErrorCode + ":" + e.Message);
                Environment.Exit(e.ErrorCode);
            }

            byte[] rcvBuffer = new Byte[BUFSIZE];

            int byteRcv;

            while (true)
            {
               Socket sock = null;

                try
                {
                    sock = listner.AcceptSocket();

                    Console.Write("Handling Client at " + sock.RemoteEndPoint + " : ");
                    int totalBytesEchoed = 0;

                  while ((byteRcv = sock.Receive(rcvBuffer, 0, rcvBuffer.Length, SocketFlags.None)) > 0)
                    {
                        string caps = Encoding.ASCII.GetString(rcvBuffer);
                        caps.ToUpper();
                        rcvBuffer = Encoding.ASCII.GetBytes(caps);
                        sock.Send(rcvBuffer, 0, byteRcv, SocketFlags.None);
                        totalBytesEchoed += byteRcv;
                    }
                    Console.WriteLine("Sent : " + rcvBuffer.ToString());
                    Console.WriteLine("Echoed {0} bytes.", totalBytesEchoed);

                    sock.Close();

                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    sock.Close();
                }
            }
        }
开发者ID:RobertLutken,项目名称:TCP_IP_TEST,代码行数:55,代码来源:Program.cs

示例5: PowerFanCtrl

 /// <summary>
 /// Manually powers on/off a USB fan in the event it does not conflict with Fan Automation.
 /// </summary>
 /// <param name="fanNumber">Numbered fan to power on or off.</param>
 /// <param name="powerOn">true to power fan; false to unpower.</param>
 /// <returns>Asynchronous processing task.</returns>
 public async Task PowerFanCtrl(Byte fanNumber, bool powerOn)
 {
     //Call Worker.
     await RESTWorker("/MooseBox/API/v1.0/control/fan/power",
                      Method.PUT,
                      restRequest =>
                      {
                          restRequest.AddQueryParameter(ParamFanNumber, fanNumber.ToString());
                          restRequest.AddQueryParameter(ParamPowerOn, powerOn.ToString().ToLower());
                      });
 }
开发者ID:ChristopherJCavage,项目名称:MooseBox,代码行数:17,代码来源:MooseBoxRESTAPI_v1_0.cs

示例6: ByteToStr

		///<summary>The only valid input is a value between 0 and 15.  Text returned will be 1-9 or a-f.</summary>
		private static string ByteToStr(Byte byteVal) {
			//No need to check RemotingRole; no call to db.
			switch(byteVal) {
				case 10:
					return "a";
				case 11:
					return "b";
				case 12:
					return "c";
				case 13:
					return "d";
				case 14:
					return "e";
				case 15:
					return "f";
				default:
					return byteVal.ToString();
			}
		}
开发者ID:mnisl,项目名称:OD,代码行数:20,代码来源:FormEhrHash.cs

示例7: ToSqlString

 /// <summary>
 /// Converts the value of the specified nullable 8-bit unsigned integer  to its equivalent SqlString representation.
 /// </summary>
 /// <param name="value">A nullable 8-bit unsigned integer.</param>
 /// <returns>The SqlString equivalent of the nullable 8-bit unsigned integer value.</returns>
 public static SqlString ToSqlString(Byte? value) { return value.HasValue ? value.ToString() : SqlString.Null; }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:6,代码来源:Convert.cs

示例8: ToString

 /// <summary>
 /// Converts the value of the specified nullable 8-bit unsigned integer  to its equivalent String representation.
 /// </summary>
 /// <param name="value">A nullable 8-bit unsigned integer.</param>
 /// <returns>The String equivalent of the nullable 8-bit unsigned integer value.</returns>
 public static String ToString(Byte? value) { return value.ToString(); }
开发者ID:mstaessen,项目名称:fluorinefx,代码行数:6,代码来源:Convert.cs

示例9: ToSqlString

		/// <summary>Converts the value from <c>Byte</c> to an equivalent <c>SqlString</c> value.</summary>
		public static SqlString ToSqlString(Byte            p) { return p.ToString();                                                                     }
开发者ID:titolarz,项目名称:bltoolkit,代码行数:2,代码来源:Convert.generated.cs

示例10: ToSqlChars

		/// <summary>Converts the value from <c>Byte?</c> to an equivalent <c>SqlChars</c> value.</summary>
		public static SqlChars ToSqlChars(Byte? p)           { return p.HasValue? new SqlChars(p.ToString().ToCharArray()): SqlChars.Null; }
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:2,代码来源:Convert.cs

示例11: SCsendLEDarray

 public void SCsendLEDarray(Byte[] ledStripArray)
 {
     if (this.comPortOpen)
     {
         arduinoBoard.WriteLine("99");
         arduinoBoard.WriteLine(ledStripArray.ToString());
     }
 }
开发者ID:bherrchen,项目名称:WS2812-CaseLedstripControl,代码行数:8,代码来源:arduino.cs

示例12: Rend

 static public String Rend(Byte d)
 {
     return d.ToString();
 }
开发者ID:tempbottle,项目名称:INCC6,代码行数:4,代码来源:Format.cs

示例13: SetLedBlinkPatternAsync

        /// <summary>
        /// Uses a feature report to set the blink pattern on the SuperMutt's LED. 
        /// 
        /// Please note that when we create a FeatureReport, all data is nulled out in the report. Since we will only be modifying 
        /// data we care about, the other bits that we don't care about, will be zeroed out. Controls will effectively do the same thing (
        /// all bits are zeroed out except for the bits we care about).
        /// 
        /// Any errors in async function will be passed down the task chain and will not be caught here because errors should be handled 
        /// at the end of the task chain.
        ///
        /// The SuperMutt has the following patterns:
        /// 0 - LED always on
        /// 1 - LED flash 2 seconds on, 2 off, repeat
        /// 2 - LED flash 2 seconds on, 1 off, 2 on, 4 off, repeat
        /// ...
        /// 7 - 7 iterations of 2 on, 1 off, followed by 4 off, repeat
        /// </summary>
        /// <param name="pattern">A number from 0-7. Each number represents a different blinking pattern</param>
        /// <returns>A task that can be used to chain more methods after completing the scenario</returns>
        async Task SetLedBlinkPatternAsync(Byte pattern)
        {
            var featureReport = EventHandlerForDevice.Current.Device.CreateFeatureReport(SuperMutt.LedPattern.ReportId);

            var dataWriter = new DataWriter();

            // First byte is always the report id
            dataWriter.WriteByte((Byte) featureReport.Id);
            dataWriter.WriteByte(pattern);

            featureReport.Data = dataWriter.DetachBuffer();

            await EventHandlerForDevice.Current.Device.SendFeatureReportAsync(featureReport);

            rootPage.NotifyUser("The Led blink pattern is set to " + pattern.ToString(), NotifyType.StatusMessage);
        }
开发者ID:oldnewthing,项目名称:old-Windows8-samples,代码行数:35,代码来源:Scenario2_FeatureReports.xaml.cs

示例14: IsLandingSquareEmpty

        private Boolean IsLandingSquareEmpty(Byte startSquare, MoveDirection jumpDirection)
        {
            Boolean answer = false;
            String start = startSquare.ToString() + jumpDirection.ToString().ToLower();
            Byte landingSquare = JumpLandingSquareLookup[start];
            UInt64 landingBitBoard = squareTable[landingSquare];

            if ((emptySquares & landingBitBoard) != 0UL)
                answer = true;

            return answer;
        }
开发者ID:kirkBurleson,项目名称:Checkers,代码行数:12,代码来源:Engine.cs

示例15: CreateMoveFromJump

        private Move CreateMoveFromJump(Byte index, MoveDirection direction)
        {
            String key = index.ToString() + direction.ToString().ToLower();
            Byte landingSquare = JumpLandingSquareLookup[key];
            Move move = new Move(index, landingSquare, true);

            return move;
        }
开发者ID:kirkBurleson,项目名称:Checkers,代码行数:8,代码来源:Engine.cs


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