小编use*_*378的帖子

转换获取字符的unicode(?)值?

我需要将char转换为int和back.

这是我用来将char转换为int的方法:

(char)65 // Returns 'a'
Run Code Online (Sandbox Code Playgroud)

以下是我正在尝试将其转换回来的内容:

(int)'a' // Returns 97
Run Code Online (Sandbox Code Playgroud)

任何想法我能做什么?

c# unicode converter

6
推荐指数
1
解决办法
4507
查看次数

Lidgren网络,无法让它连接

我无法让我的客户端在我的lindgren网络测试中连接到我的服务器.我尝试了多种连接方式,但是当我尝试连接时它总是停止.对不起,如果这是一个广泛的问题,但我做错了什么?这是我的代码:

class Program
{
    static NetPeerConfiguration serverconfig;
    static NetPeerConfiguration clientconfig;
    static NetServer server;
    static NetClient client;

    static void Main()
    {
        Console.Title = "LidgrenNetworkTest";
        Console.ForegroundColor = ConsoleColor.Yellow;
        Console.WriteLine("LidgrenNetworkTest console initialized.");
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write("Color codes: ");
        Console.ForegroundColor = ConsoleColor.Yellow;
        Console.Write("System ");
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write("Input ");
        Console.ForegroundColor = ConsoleColor.Red;
        Console.Write("Sent ");
        Console.ForegroundColor = ConsoleColor.Cyan;
        Console.Write("Received");
        Console.ForegroundColor = ConsoleColor.Yellow;
        Console.WriteLine("\n");

        Console.WriteLine("Configuring server...");
        serverconfig = new NetPeerConfiguration("LidgrenNetworkTest");
        serverconfig.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
        serverconfig.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
        serverconfig.LocalAddress = NetUtility.Resolve("localhost");
        serverconfig.Port = 8080;
        Console.WriteLine("Server configured.");

        Console.WriteLine("Configuring client...");
        clientconfig = new NetPeerConfiguration("LidgrenNetworkTest"); …
Run Code Online (Sandbox Code Playgroud)

c# networking

5
推荐指数
1
解决办法
3331
查看次数

标签 统计

c# ×2

converter ×1

networking ×1

unicode ×1