473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating strings using Console.WriteLine format

Hello. I'm new to C#. I've searched this group, and tried other google
searches, and have not found an answer to this question already.

The question is pretty simple. I like the Console.WriteLine format of
passing a string containing {0}, {1}, etc, followed by a parameter
list of values. For example:

Console.WriteLine("The value is {0}", someValue);

I would like to be able to create strings in my applications using the
same format, with the {x} replacement. Is there a class I can call to
do this? I don't yet know my way around C# enough to figure this out.

Jun 24 '07 #1
2 2997
You can use format method of String class.

SG

<da*********@gmail.comwrote in message
news:11*********************@u2g2000hsc.googlegrou ps.com...
Hello. I'm new to C#. I've searched this group, and tried other google
searches, and have not found an answer to this question already.

The question is pretty simple. I like the Console.WriteLine format of
passing a string containing {0}, {1}, etc, followed by a parameter
list of values. For example:

Console.WriteLine("The value is {0}", someValue);

I would like to be able to create strings in my applications using the
same format, with the {x} replacement. Is there a class I can call to
do this? I don't yet know my way around C# enough to figure this out.

Jun 24 '07 #2
String.Format

Użytkownik "Gugale at Lincoln" <gu**************@gmail.comnapisał w
wiadomo¶ci news:Zl*****************@newssvr25.news.prodigy.ne t...
You can use format method of String class.

SG

<da*********@gmail.comwrote in message
news:11*********************@u2g2000hsc.googlegrou ps.com...
>Hello. I'm new to C#. I've searched this group, and tried other google
searches, and have not found an answer to this question already.

The question is pretty simple. I like the Console.WriteLine format of
passing a string containing {0}, {1}, etc, followed by a parameter
list of values. For example:

Console.WriteLine("The value is {0}", someValue);

I would like to be able to create strings in my applications using the
same format, with the {x} replacement. Is there a class I can call to
do this? I don't yet know my way around C# enough to figure this out.


Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Rigga | last post by:
Hi all, I am wondering why string's are not true objects?.... Let me explain... If i write the code Dim x1 as String = "veg" Dim x2 as String = "veg" If x1 = x2 then
5
by: Colin Savage | last post by:
Please could somebody explain what an "atomized string" is? I have been doing loops in the msdn around XmlNameTable and NameTable but neither explain what an atomized string is. The example for one...
16
by: Robert Blackwell | last post by:
I decided to take a class at the local college here and I'm a little confused about something. int age = 5; Console.WriteLine("You are " + age + " years old"); Previously, I had been...
7
by: Clinton Pierce | last post by:
I'm calling a method in another assembly that's supposed to return a string, and possibly that string might be empty. The code looks something like this: string d = r.Field("date").ToString();...
4
by: Ashok | last post by:
Hello I need to programmatically change the permissions (ACL) on a specific registry key in a .NET app. Is there a way to do this in .NET? Thanks for the help, Ashok
2
by: josh | last post by:
Hi, I am trying to validate cXML documents against cXML.dtd using the XmlValidatingReader. If I set the XMLValidatingReader's ValidatingType to ValidationType.DTD, I get the following...
1
by: DLN | last post by:
Hello all, I have a quick question regarding how best to use static strings in my C# code that I'm hoping someone can help me with. Is there any advantage/disadvantage from a performance...
11
by: Andrus | last post by:
I created dynamic extension methods for <= and < SQL comparison operators: public static IQueryable<TLessThanOrEqual<T>(this IQueryable<Tsource, string property, object value); public static...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.