C#使用UdpClient发送和接收UDP数据示例

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.W …… 阅读全文

C# Winform使用线程,委托定时更新界面UI控件,解决界面卡顿问题

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using System.Linq;using System.Net;using System.Net …… 阅读全文

c# 【MVC】WebApi开发实例

using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations;using System.Linq;using System.Web;namespace ProductStore.Models{ //商品实体类 public class Product …… 阅读全文

c# 【MVC】WebApi返回各种类型(图片/json数据/字符串)

using System.IO;/// /// WebApi返回图片/// public HttpResponseMessage GetQrCode(){ var imgPath = @"D:\ITdosCom\Images\itdos.jpg"; //从图片中读取byte var imgByte = File.ReadAllBytes(imgPath); …… 阅读全文

c# 【MVC】WebApi通过HttpClient来调用Web Api接口

/// /// HttpClient实现Post请求(异步)/// static async void dooPost(){ string url = "http://localhost:52824/api/register"; //设置HttpClientHandler的AutomaticDecompression var handler = new HttpClientHand …… 阅读全文

c# 【MVC】WebApi设置返回Json

public static HttpResponseMessage toJson(Object obj) { String str; if (obj is String || obj is Char) { str = obj.ToString(); } …… 阅读全文