Click here to Skip to main content
15,881,204 members
Home / Discussions / C#
   

C#

 
QuestionSqlDataAdapter .Fill() using DataTable instead of DataSet? Pin
zoltan_ie16-Apr-03 7:15
zoltan_ie16-Apr-03 7:15 
AnswerRe: SqlDataAdapter .Fill() using DataTable instead of DataSet? Pin
James T. Johnson16-Apr-03 7:30
James T. Johnson16-Apr-03 7:30 
GeneralRe: SqlDataAdapter .Fill() using DataTable instead of DataSet? Pin
zoltan_ie16-Apr-03 22:45
zoltan_ie16-Apr-03 22:45 
GeneralGet proc only for current user Pin
Alex Korchemniy16-Apr-03 5:50
Alex Korchemniy16-Apr-03 5:50 
GeneralRe: Get proc only for current user Pin
Mazdak16-Apr-03 8:30
Mazdak16-Apr-03 8:30 
GeneralOwnerdrawn StatusBarPanel Pin
monrobot1316-Apr-03 5:48
monrobot1316-Apr-03 5:48 
GeneralRe: Ownerdrawn StatusBarPanel Pin
Alex Korchemniy16-Apr-03 5:55
Alex Korchemniy16-Apr-03 5:55 
GeneralArgument-substitution vs Concatenation Pin
Alvaro Mendez16-Apr-03 4:37
Alvaro Mendez16-Apr-03 4:37 
When I started learning about C#, I noticed the sample programs would use the funky argument-substitution notation inside Console.WriteLine, similar to printf in C:

int a = 17;
string b = "something";
 
Console.WriteLine("a = {0} and b = {1}", a, b);

When I finally got around to writing some code, I decided to stick with the Java approach of simply contatenating everything, which to me seems easier to read and less error prone:

Console.WriteLine("a = " + a + " and b = " + b);


I'd like to get some opinions on the pros and cons of each approach.

Why does Microsoft seem to promote the first technique? The thing is, you look at other WriteLines, such as Debug.WriteLine and Trace.WriteLine and they don't take a variable number of arguments, so you can't use the argument-substitution technique there. Confused | :confused:

Thanks,
Alvaro


When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
GeneralRe: Argument-substitution vs Concatenation Pin
Alex Korchemniy16-Apr-03 5:54
Alex Korchemniy16-Apr-03 5:54 
GeneralRe: Argument-substitution vs Concatenation Pin
James T. Johnson16-Apr-03 7:00
James T. Johnson16-Apr-03 7:00 
GeneralRe: Argument-substitution vs Concatenation Pin
Paul Ingles16-Apr-03 7:56
Paul Ingles16-Apr-03 7:56 
GeneralRe: Argument-substitution vs Concatenation Pin
Adam Turner16-Apr-03 12:42
Adam Turner16-Apr-03 12:42 
GeneralRe: Argument-substitution vs Concatenation Pin
leppie16-Apr-03 12:54
leppie16-Apr-03 12:54 
GeneralDateTime Operation Pin
Mazdak16-Apr-03 3:52
Mazdak16-Apr-03 3:52 
GeneralRe: DateTime Operation Pin
Jim Stewart16-Apr-03 4:21
Jim Stewart16-Apr-03 4:21 
GeneralRe: DateTime Operation Pin
Mazdak16-Apr-03 4:42
Mazdak16-Apr-03 4:42 
GeneralLoad File Pin
Mazdak16-Apr-03 2:48
Mazdak16-Apr-03 2:48 
GeneralRe: Load File Pin
Chris Austin16-Apr-03 5:19
Chris Austin16-Apr-03 5:19 
GeneralRe: Load File Pin
Mazdak16-Apr-03 8:15
Mazdak16-Apr-03 8:15 
GeneralCheck if a windows service is installed Pin
AndyLatham16-Apr-03 2:20
AndyLatham16-Apr-03 2:20 
GeneralRe: Check if a windows service is installed Pin
Mazdak16-Apr-03 2:52
Mazdak16-Apr-03 2:52 
GeneralRe: Check if a windows service is installed Pin
AndyLatham16-Apr-03 4:06
AndyLatham16-Apr-03 4:06 
GeneralRe: Check if a windows service is installed Pin
Mazdak16-Apr-03 4:42
Mazdak16-Apr-03 4:42 
GeneralRe: Check if a windows service is installed Pin
AndyLatham16-Apr-03 5:04
AndyLatham16-Apr-03 5:04 
GeneralRe: Check if a windows service is installed Pin
sludgenz29-Oct-08 16:22
sludgenz29-Oct-08 16:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.