
C#
w0100746363
最怕你一生碌碌无为,还安慰自己平凡可贵!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C# 用变量的值通过反射获取变量的属性名
public class Test { public const string test1 = "Test1"; public const string test2 = "Test2"; } private Test testObj = new Test(); private Type testType = testObj.GetType(); private PropertyInfo[] properties = testObj.GetProperties(Binding...原创 2020-12-26 10:28:41 · 1934 阅读 · 0 评论 -
C# 开发中遇到的一些小技巧
开发中遇到的一些C#封装好的接口或者小技巧(暂时算一些小技巧吧,没想到更好的表达)。 1、数组中包含某个元素的个数 //数组中字符串a的个数 string[] a = { "ab", "ac", "a", "ac", "bc", "c" }; int countA = a.Count(item => item.Contains("a")); //数组中true的个数 bool[] b = { true, false, true, true, false }; int count = b.Cou原创 2020-05-19 15:03:44 · 200 阅读 · 0 评论 -
C#的格式化数据
总结了一下官网的数据格式化,很多在实际开发中很实用。详细的可以上官网查看 官网地址:https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/formatting-types 1、“C”或“c” :货币,将数字转换为表示货币金额的字符串。 精度说明符指示结果字符串中的所需小数位数,国家说明符指示转换后的国家标识, 没有精度符和国...原创 2018-08-27 18:41:27 · 1635 阅读 · 0 评论