.NET
.NET是一种用于构建多种应用的免费开源开发平台,可以使用C#、F#或Visual Basic编写.NET应用。 [10] .NET用于生成多种类型的应用程序和库开发Web应用、Web API和微服务、云中的无服务器函数、云原生应用、移动应用、桌面应用、Windows WPF、Windows窗体
编程课堂
帮助别人,快乐自己
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C# 调用cmd执行指令
业务代码:using System.Diagnostics;private void InvokePostman(){ Process process = new Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.原创 2021-01-31 20:23:30 · 400 阅读 · 0 评论 -
C# 判断一个网址是否可以打开
需求: 使用定时器定时检测一个网址是否可以打开。代码:using System;using System.Net;using System.Windows.Forms;namespace Test{ public partial class Form1 : Form { private Timer TestTimer = new Timer(); public Form1() { InitializeCo原创 2021-01-19 18:32:35 · 2051 阅读 · 2 评论 -
C# WinForm Timer定时器
1、实现代码using System;using System.Windows.Forms;namespace Test_Timer{ public partial class Form1 : Form { private Timer TestTimer = new Timer(); public Form1() { InitializeComponent(); TestTimer.原创 2021-01-08 17:35:09 · 1673 阅读 · 0 评论 -
C# 上传文件至SFTP
1、安装SSH.NET类库程序包Install-Package SSH.NET -Version 2020.0.0-beta1更多版本:https://www.nuget.org/packages/SSH.NET/2、代码:using System;using System.IO;using System.Threading.Tasks;using System.Collections.Generic;using Renci.SshNet;using Renci.SshNet.Sftp原创 2020-12-05 15:58:07 · 888 阅读 · 2 评论 -
C# 使用FluentFTP上传文件至FTP
1、FluentFTP类库简介引用:FluentFTP是一款老外开发的基于.Net的支持FTP及的FTPS 的FTP类库,FluentFTP是完全托管的FTP客户端,被设计为易于使用和易于扩展。它支持文件和目录列表,上传和下载文件和SSL / TLS连接。它可以连接到Unix和Windows IIS建立FTP服务器。2、简单使用2.1、安装FluentFTP类库程序包Install-Package FluentFTP -Version 33.0.3更多版本:https://www.nuget原创 2020-12-05 15:15:25 · 4958 阅读 · 0 评论 -
C# Web.config连接MySQL、SQL Server数据库配置
1、MySQL<connectionStrings> <add name="db" connectionString="Server=ip地址;Database=数据库名;Uid=用户名;Pwd=密码;charset=utf8;pooling=true;" providerName="MySql.Data.MySqlClient" /></connection...原创 2019-12-17 11:43:10 · 3611 阅读 · 1 评论 -
C# Session 拦截 未登录用户 拦截到登录页面
对于有些项目我们希望当用户登录了,才可以让他看到里面的内容,没有登录的时候,我们把用户拦截到登录页面,进行登录。网站开发中,为了保存用户信息,我们就会用到Session简单 Session 拦截案例1、创建 ASP.NET 应用程序,主要代码如下:① HomeController.csusing System.Web.Mvc;using Test.BLL;using Test.Ut...原创 2019-12-17 11:27:21 · 1823 阅读 · 0 评论 -
C# 实体对象序列化成 Json,并让字段的首字母小写两种解决办法
1、在实体类上属性上加上[JsonProperty("id")]using PetaPoco;using Newtonsoft.Json;namespace Test.Model{ [TableName("students")] public class Student { [Column("id")] [JsonProperty(...原创 2019-12-02 21:56:53 · 1651 阅读 · 0 评论 -
C# 使用Newtonsoft.Json的JsonProperty设置返回的Json数据列名
在写分页的时候,返回Json数据给前台的时候,数据不能出来,原因就是Json数据的列名是大写的,而页面需要的是小写的。解决办法public class PageResult<T>{ [JsonProperty("total")] public long Total { get; set; } [JsonProperty("rows")] pub...原创 2019-11-25 12:58:08 · 4725 阅读 · 0 评论 -
C# 返回Json数据格式忽略实体类空值属性
1、创建ASP.NET Web应用程序,项目结构如图:2、连接MySQL数据库①、在Web.config加入连接数据的的配置 <connectionStrings> <add name="db" connectionString="Server=localhost;Database=studentdb;Uid=root;Pwd=root;charset=utf8...原创 2019-11-23 14:02:47 · 5156 阅读 · 0 评论 -
C# Guid的使用
1、什么是Guid?Guid(Globally Unique Identifier):全局唯一标识符。GUID是一种由算法生成的二进制长度为128位的数字标识符。2、为什么要使用Guid?①、GUID(全局统一标识符)是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的。②、对于程序开发的各个方面,.NET Framework简化了建立和处理GUID数值的过程。在.NET...转载 2019-11-20 13:03:55 · 2833 阅读 · 0 评论 -
C#获取两个日期中间天数的方法
using System;namespace TestTimeIntervalDay{ class Program { static void Main(string[] args) { DateTime fromDate = new DateTime(2019, 11, 1); DateTime...转载 2019-11-05 17:47:17 · 2226 阅读 · 0 评论 -
C# 委托的使用
一、概念1、什么是委托?把方法作为参数进行传递,被传递的类型就是委托。委托相当于一个父类型,一组具有相同的返回值,参数签名的父对象。2、简单案例using System;namespace TestDelegation{ class Program { // 定义委托类型及其参数 public delegate int Arithmet...原创 2019-11-02 21:43:20 · 178 阅读 · 0 评论 -
C# ASP.NET 读取Web.config配置文件appSettings标签里的内容
1、在appSetting里面配置时间2、读取时间 private static string fromDate = ConfigurationManager.AppSettings["fromDate"]; private static string toDate = ConfigurationManager.AppSettings["toDate"];...原创 2019-11-02 21:42:35 · 1360 阅读 · 0 评论 -
C# Base64方式编码和解码
创建控制台应用程序,主要代码在Program.cs中测试。using System;using System.Text;namespace TestBase64{ class Program { static void Main(string[] args) { string encode = EncodeBase6...原创 2019-10-26 17:22:58 · 412 阅读 · 0 评论 -
C# List<T>泛型集合Sort方法排序
1、原创 2019-10-26 15:35:20 · 6133 阅读 · 2 评论 -
C# winform窗体使用WebBrowser控件显示百度地图
C# winform窗体使用WebBrowser控件显示百度地图1、效果展示2、创建winfrom窗体应用程序,项目结构如下:3、点开MapForm窗体,添加WebBroswer控件4、主要代码4.1、map.html<!DOCTYPE html><html><head> <meta http-equiv="Content-T...原创 2019-10-11 11:53:29 · 1732 阅读 · 2 评论
分享