Create a LiNQ In Every Day
来源:互联网 发布:哈工大威海网络系统 编辑:程序博客网 时间:2024/05/18 03:06
ToLowerInvariant : 返回字符转换为小写的结果,使用固定区域性的大小写规则。
也就是说这个转换与Visual Studio 的设置字体风格一致。
ToLower : 返回字符转换为小写的结果,使用当前区域性的大小写规则。
这个转换与程序代码(上下文)的设置字体风格一致。
static void Main()
{
string text = @"Historically, the world of data and the world of objects" +
@" have not been well integrated. Programmers work in C# or Visual Basic" +
@" and also in SQL or XQuery. On the one side are concepts such as classes," +
@" objects, fields, inheritance, and .NET Framework APIs. On the other side" +
@" are tables, columns, rows, nodes, and separate languages for dealing with" +
@" them. Data types often require translation between the two worlds; there are" +
@" different standard functions. Because the object world has no notion of query, a" +
@" query can only be represented as a string without compile-time type checking or" +
@" IntelliSense support in the IDE. Transferring data from SQL tables or XML trees to" +
@" objects in memory is often tedious and error-prone.";
string searchTerm = "data";
//Convert the string into an array of words
string[] source = text.Split(new char[] { '.', '?', '!', ' ', ';', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
// Create and execute the query. It executes immediately
// because a singleton value is produced.
// Use ToLowerInvariant to match "data" and "Data"
var matchQuery = from word in source
where word.ToLowerInvariant() == searchTerm.ToLowerInvariant()
select word;
// Count the matches.
int wordCount = matchQuery.Count();
Console.WriteLine("{0} occurrences(s) of the search term /"{1}/" were found.", wordCount, searchTerm);
// Keep console window open in debug mode
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
- Create a LiNQ In Every Day
- log4j create a new log file every day
- A sentence every day
- a sentence every day!
- a sentence every day!
- Every Day is a Lucky
- React Native 每日一学(Learn a little every day)
- React Native 每日一学(Learn a little every day)
- Every activity runs in a separate process?
- Reverse every word in a String
- do it every day
- happy every day !
- coding every day
- Write Code Every Day
- 林小欣的every day
- 林小欣的every day
- IOS study every day
- QKE, reading every day
- Symbian 更换主题
- 零碎的记记(续5)——北戴河
- 关于Map中的重复键
- 学习感受
- Qt for Symbian 资料
- Create a LiNQ In Every Day
- 半年了!
- ubuntu 因重装而无法进入
- C++标准库之中文输出详细介绍
- CSS选择器笔记
- redhat5.2 下源码安装PHP5.3.3
- 大型网站架构系列之一,前言,不得不考虑的问题
- 解決Windows 2003自带的IIS上傳文檔限制
- 期待给自己放假