Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Sunday, 5 June 2016

Difference between string and String builder

Show below for demonstration of  Difference between string and String builder.

String
String belongs to system namespace. Its commonly use reference type.  If we are not perform any operation string is fast.  We can initialize the string directly like below.

string str = "name";

Friday, 20 March 2015

convert list to string c#

There are many ways you will do convert list to string c# from google. But what you will adopt, which is good in terms of line and in terms of complexity.

 I will demonstrate three ways to convert list to string c# with “,” seperated  and you will see that which one is taking less time in execution.
Suppose you have list of sting, that you can form like below code; Having 1Lakhs of string records


Saturday, 1 November 2014

Converting String to Int in C#

String is the reference type in C# and int is the value type.(What is Ref and Value type )
So, The way of maintain the memory location are quite different for both of them and to converting the value to refrence is called boxing in C#.

If you see the below program;
static void Main(string[] args)
        {
            int i = 123;
            string str = "123";

            if (str.Equals(i))
                Console.WriteLine("Success");
            else
                Console.WriteLine("fails");

        }

Saturday, 22 March 2014

How to Convert array to string ?

Converting the list of array values into form of string, This helps  to show the value into any control or to store many values in a single database field.

How it work?  suppose you have Array like “Xx”, “ Yy” and “ Zz”,  There  you can join and get the value into string like “Xx Yy Zz”.
There is string method to make it simple to join the array and from a single string.