In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "how to create String objects in C#". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to create String objects in C#" can help you solve your doubts.
Create a String object
You can create a string object using one of the following methods:
By assigning a string to the String variable
By using the String class constructor
By using the string concatenation operator (+)
By retrieving a property or calling a method that returns a string
Convert a value or object to its string representation by formatting
The following example demonstrates this:
Using System
Namespace StringApplication
{
Class Program
{
Static void Main (string [] args)
{
String / string concatenation
String fname, lname
Fname = "Rowan"
Lname = "Atkinson"
String fullname = fname + lname
Console.WriteLine ("Full Name: {0}", fullname)
/ / by using the string constructor
Char [] letters = {'Haugh,' eBay, 'lumbago.
String greetings = new string (letters)
Console.WriteLine ("Greetings: {0}", greetings)
/ / method returns a string
String [] sarray = {"Hello", "From", "Tutorials", "Point"}
String message = String.Join ("", sarray)
Console.WriteLine ("Message: {0}", message)
/ / formatting method for converting values
DateTime waiting = new DateTime (2012, 10, 10, 17, 58, 1)
String chat = String.Format ("Message sent at {0VR t} on {0v D}"
Waiting)
Console.WriteLine ("Message: {0}", chat)
Console.ReadKey ()
}
}
}
When the above code is compiled and executed, it produces the following results:
Full Name: RowanAtkinsonGreetings: HelloMessage: Hello From Tutorials PointMessage: Message sent at 17:58 on Wednesday, 10 October 2012 read here, this "how to create String objects in C#" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related content of the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.