大家用了这么久的.net有没有发现C#中可以用中文变量呀!!可用这个特性来彻底改变程序的易读性(搞笑).但其实有一个非常独特的用处的

这篇博客探讨了在C#中使用中文变量的可能性,指出虽然这可以增加程序的易读性,但也带有娱乐性质。作者通过一个Windows Forms应用程序实例展示了如何创建和使用中文变量,并提出在.NET PropertyGrid Control中显示中文信息时,可能需要依赖中文变量。文章鼓励开发者思考不同寻常的方式来提高代码的可读性。
摘要由CSDN通过智能技术生成

举个例子:
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication1
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;
  private int 整型; //中文变量!!
  private string 字符型;

  public Form1()
  {
   InitializeComponent();
   整型=123456789;
   字符型="有可能改善程序代码的易读性!!";
   MessageBox.Show(字符型+this.整型.ToString());
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值