Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to "inject" string Pin
Philippe Mori2-Jul-11 12:37
Philippe Mori2-Jul-11 12:37 
AnswerRe: how to "inject" string Pin
#realJSOP3-Jul-11 5:59
professional#realJSOP3-Jul-11 5:59 
Your sample doesn't really make any sense.

Why don't you just do it this way:

C#
for (int i = 0; i < arr.Length; i++)
{
    dic.Add(arr[i], arr.length);
}


One of the Console.WriteLine method overloads acts just like string.Format. You pass a format string, followed by an array of objects. The number inside the curly braces indicates the index into the specified object array. Just like all other arrays, this one is 0 based, and you can't specify a value < 0 or > the number of elements in the array (minus 1). You can specify the same array index over and over again:

WriteLine("{0}{0}{0}", "x", "y");


which would result in "xxx" being written

or even out of order:

WriteLine("{2}{1}{0}", "x", "y", "z");


which would result in "zyx" being written.

You can have more objects to format, but your indexes in the format string can never exceed the number of objects in the array.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997


AnswerRe: how to "inject" string Pin
Shameel3-Jul-11 8:34
professionalShameel3-Jul-11 8:34 
Questionms access afterupdate event in c# textbox Pin
Asif Rehman1-Jul-11 23:34
Asif Rehman1-Jul-11 23:34 
AnswerRe: ms access afterupdate event in c# textbox Pin
JOAT-MON2-Jul-11 3:12
JOAT-MON2-Jul-11 3:12 
AnswerRe: ms access afterupdate event in c# textbox Pin
JOAT-MON2-Jul-11 3:26
JOAT-MON2-Jul-11 3:26 
QuestionFile Type forensic identification Pin
devvvy1-Jul-11 14:20
devvvy1-Jul-11 14:20 
AnswerRe: File Type forensic identification Pin
Philippe Mori1-Jul-11 14:58
Philippe Mori1-Jul-11 14:58 
AnswerRe: File Type forensic identification Pin
PIEBALDconsult1-Jul-11 18:51
mvePIEBALDconsult1-Jul-11 18:51 
QuestionImplementing a list of abstract objects... Pin
faheemnadeem1-Jul-11 10:15
faheemnadeem1-Jul-11 10:15 
AnswerRe: Implementing a list of abstract objects... Pin
Philippe Mori1-Jul-11 11:37
Philippe Mori1-Jul-11 11:37 
GeneralRe: Implementing a list of abstract objects... Pin
faheemnadeem1-Jul-11 13:52
faheemnadeem1-Jul-11 13:52 
GeneralRe: Implementing a list of abstract objects... Pin
Philippe Mori1-Jul-11 15:16
Philippe Mori1-Jul-11 15:16 
GeneralRe: Implementing a list of abstract objects... Pin
faheemnadeem1-Jul-11 15:41
faheemnadeem1-Jul-11 15:41 
GeneralRe: Implementing a list of abstract objects... Pin
Philippe Mori1-Jul-11 16:30
Philippe Mori1-Jul-11 16:30 
GeneralRe: Implementing a list of abstract objects... Pin
faheemnadeem1-Jul-11 18:09
faheemnadeem1-Jul-11 18:09 
GeneralRe: Implementing a list of abstract objects... Pin
Philippe Mori2-Jul-11 3:30
Philippe Mori2-Jul-11 3:30 
GeneralRe: Implementing a list of abstract objects... Pin
faheemnadeem2-Jul-11 4:08
faheemnadeem2-Jul-11 4:08 
QuestionC# to MATLAB connectivity in windows 7 Pin
Sa na1-Jul-11 9:03
Sa na1-Jul-11 9:03 
AnswerRe: C# to MATLAB connectivity in windows 7 Pin
Dave Kreskowiak1-Jul-11 11:10
mveDave Kreskowiak1-Jul-11 11:10 
GeneralRe: C# to MATLAB connectivity in windows 7 Pin
Sa na2-Jul-11 1:13
Sa na2-Jul-11 1:13 
GeneralRe: C# to MATLAB connectivity in windows 7 Pin
Sa na2-Jul-11 2:52
Sa na2-Jul-11 2:52 
QuestionIs file mapping supported in microsoft .net framework Pin
Danzy831-Jul-11 5:26
Danzy831-Jul-11 5:26 
AnswerRe: Is file mapping supported in microsoft .net framework Pin
Ennis Ray Lynch, Jr.1-Jul-11 6:06
Ennis Ray Lynch, Jr.1-Jul-11 6:06 
QuestionHow do I monitor bytes per second written or read from a directory (and sub-directories)? Pin
bbranded1-Jul-11 5:16
bbranded1-Jul-11 5:16 

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.