Posts

String Program in C#

using System; using System.Linq; 1)Reverse Name String  in C# String Name="Sudam"; int Len=Name.Length-1; while(Len>=0) { Console.Write(Name[Len]); Len--; } ----------------------------------------- Output --madus ----------------------------------------- 2)Reverse Words of a String in C# string s = "I Name Is Sudam"; string[] a = s.Split(' '); int temp= a.Length - 1; while (temp >= 0) {     Console.Write(a[temp] + ' ');     temp--; } ------------------------------------------ Output --Sudam Is Name I ---------------------------------------- 3) How to Fine count how many double letters are in a string? int doubleLetters = 0; string characters = "Hello"; for (int i = 0; i < characters.Length - 1; i++) {     if (characters[i] == characters[i + 1])     {         doubleLetters++;         i++;     }     Console.WriteLine(doubleLetters); } -----------------------------------------...

Ref Vs Out Keyword

                                                 Ref Vs Out Keyword Ref vs Out Keyword in C#     Ref-      1)R ef parameter should have the same value.      2)Ref keyword is used to pass an argument as a reference     3) No Need to initialize out parameter before passing it.             Eg:=int a;      4) Out parameter must be initialized before returning.   Out -       1)O ut parameters are not required to have value      2)Out keyword is also used to pass an argument like ref keyword      3)Must initialize Ref parameter else error.          Eg:=int b=5;        4) Ref parameter  initialized not necessary. When t...

Popular posts from this blog

Insert Data in database and bind to gridview

Api

Oracle database