Snippets
DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Recent Snippets
- String
- zero
- null
- .net
- length
Check If String Is Null / Zero Length
05/07/12 by Snippets Managerstring strCheck = ''; bool checkString = String.IsNullOrEmpty(strText);
0 Replies
- method
- shunning
- extension
Shunning Extension Method To Filter Order And Sort- Linq
05/07/12 by Snippets Managerstring[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" }; IEnumerable<string> query = Enumerable.Select ( Enumerable.OrderBy ( Enumerable.Where ( names, n => n.Contains ("a") ), n => n.Length ), n => n.ToUpper() );
0 Replies
- String
- compare
- two
Comapre Two Strings
05/07/12 by Snippets Managerstring strReverse =""; string straoriginal = "Test"; if ((string.Compare(strOriginal, strReverse , false)) < 0) { MessageBox.Show("Less"); } else if ((string.Compare(strOriginal, strReverse , false)) > 0) { MessageBox.Show("Greater"); } else if ((string.Compare(strOriginal, strReverse , false)) == 0) { MessageBox.Show("Equal"); }
0 Replies
- reverse
- csharp
- .net
- String
Reverse A String
05/07/12 by Snippets Manager in C#string strReverse =""; string straoriginal = "Test"; string strReverse= Microsoft.VisualBasic.Strings.StrReverse(strOriginal); MessageBox.Show(strReverse);
0 Replies
- LINQ
- sorting
- order
- filter
Progressive Query - LINQ
05/07/12 by Snippets ManagerProgessive form IEnumerable<string> filtered = names.Where (n => n.Contains ("a")); IEnumerable<string> sorted = filtered.OrderBy (n => n.Length); IEnumerable<string> finalQuery = sorted.Select (n => n.ToUpper());
Output Harry Mary Jay Jay Mary Harry JAY MARY HARRY
0 Replies
- .net
- split
- function
- String
Splitting A String Using String Function
05/07/12 by Snippets Managerstring string1= "Split function"; string [] SplitString = string1.Split(new Char [] {' '}); MessageBox.Show(Convert.ToString(SplitString [0])); MessageBox.Show(Convert.ToString(SplitString [1]));
0 Replies
- fluent
- LINQ
- query
Fluent Query - LINQ
05/07/12 by Snippets ManagerFluent query - LINQ
string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" }; IEnumerable<string> query = names .Where (n => n.Contains ("a")) .OrderBy (n => n.Length) .Select (n => n.ToUpper());
0 Replies
- filter
- LINQ
- query
- Simple
Simple Filter Query - LINQ
05/07/12 by Snippets ManagerSimple Filter Query
from n in new[] { "Tom", "Dick", "Harry" } where n.Contains ("a") select n
Ouput: Harry
0 Replies
- String
- .net
- function
- replace
Replace String With In String
05/07/12 by Snippets Managerstring string1 = "Replace string"; string finalstring= string1 .Replace("replace", "Replaced"); MessageBox.Show("Final Value : " + finalstring);
0 Replies
- LINQ
- extension
- method
Filter Using Extension Method - LINQ
05/07/12 by Snippets ManagerExtension method
(new[] {"T", "D", "H"} ).Where (n => n.Length >= 4)
0 Replies
- 1
- 2
- 3
- 4
- …
- >
- >>