Remove Duplicate Value

How to Remove Duplicate Value from Comma Separated String. namespace Demo { class Program { static void Main(string[] args) { string mystring = “5,6,4,8,5,6,2,5,4,5,4,5,5,8,9,1,10”; //string mystring = “josaf,mani,josaf,aaryav”; List<string> uniqueValues = mystring.ToLower().Split(‘,’).Distinct().ToList(); string UniqueString = string.Join(“,”, uniqueValues); Console.WriteLine(UniqueString); Console.ReadLine(); } } } Continue reading Remove Duplicate Value

Number Of different ways to find highest or maximum salary of a employee

Recent days i heard this is the common question that is asking in interview so i am giving some way that will help you to found the maximum salary in sql.     Create table Employee (Salary bigint, name nvarchar(max) ) insert into Employee values(100,’abc1′) insert into Employee values(103,’abc2′) insert into Employee values(1000,’abc3′) insert into Employee values(100,’abc4′) insert into Employee values(1030,’abc5′) insert into Employee values(1002,’abc6′) insert into Employee values(1001,’abc7′) insert into Employee values(100,’abc8′) insert into Employee values(10045,’abc9′) select * from Employee order by Salary desc   way 1: select top 1 salary from ( select distinct top 3 Salary from … Continue reading Number Of different ways to find highest or maximum salary of a employee

c# coding simple  question 

  1.To find total number of occurrence of a character or string . 2. how to reverse a string . 3. Find Even odd.   I am writing the method that you can call . public static int CountStringOccurrences(string text, string pattern) { int count = 0; int i = 0; while ((i = text.IndexOf(pattern, i)) != -1) { i += pattern.Length; count++; } return count; }       public static string Reverse(string s1) { string s2 = “”; int Length = s1.Length-1; while (Length >= 0) s2 = s2 + s1[Length–]; return s2; }       public … Continue reading c# coding simple  question