tag:blogger.com,1999:blog-2736643499861726924.comments2014-05-23T12:18:11.140-07:00How it's done?hairy bumblebeehttp://www.blogger.com/profile/01791609822984051218noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-2736643499861726924.post-65227894250065655742014-05-23T12:18:11.140-07:002014-05-23T12:18:11.140-07:00Later answer, but this is a great modification!Later answer, but this is a great modification!Anonymoushttps://www.blogger.com/profile/02948922753512071411noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-6374700721212069082012-07-03T12:43:39.170-07:002012-07-03T12:43:39.170-07:00Thanks a lot for these notes, they are somewhat id...Thanks a lot for these notes, they are somewhat identical to mine, but already taken to the web, thanks!Kjellskihttps://www.blogger.com/profile/06164545375653557518noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-71486601920275118762012-06-06T20:59:49.323-07:002012-06-06T20:59:49.323-07:00Any reason why you don't just use a stringbuil...Any reason why you don't just use a stringbuilder?<br /><br />Also - needed to handle the case where user presses backspace with nothing on the stack (or in the stringbuilder)<br /><br />1: public static string ReadPassword() <br />2: { <br />3: StringBuilder sb = new StringBuilder(); <br />4: for (ConsoleKeyInfo consKeyInfo = Console.ReadKey(true); consKeyInfo.Key != ConsoleKey.Enter; consKeyInfo = Console.ReadKey(true)) <br />5: { <br />6: if (consKeyInfo.Key == ConsoleKey.Backspace) <br />7: { <br />8: if (sb.Length > 0) <br />9: { <br />10: try <br />11: { <br />12: Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); <br />13: Console.Write(" "); <br />14: Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); <br />15: sb.Remove(sb.Length - 1, 1); <br />16: } <br />17: catch (InvalidOperationException) <br />18: { <br />19: Console.SetCursorPosition(Console.CursorLeft + 1, Console.CursorTop); <br />20: } <br />21: } <br />22: } <br />23: else <br />24: { <br />25: Console.Write("*"); <br />26: sb.Append(consKeyInfo.KeyChar.ToString()); <br />27: } <br />28: } <br />29: return sb.ToString(); <br />30: }Anonymoushttps://www.blogger.com/profile/07577412872220970798noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-71014005713884632092012-05-22T08:56:19.039-07:002012-05-22T08:56:19.039-07:00very good! ir 's works!very good! ir 's works!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-62849237615871308102012-04-30T09:00:10.143-07:002012-04-30T09:00:10.143-07:00Bit late to the party, but I just thought I'd ...Bit late to the party, but I just thought I'd mention an alternative means of transforming the stack to a string.<br /><br />The number of elements in the stack is Pass.Count, and we can use Pass.CopyTo() to copy the contents of the stack to an Array:<br /><br /> string[] password = new string[Pass.Count];<br /> Pass.CopyTo(password,0);<br /><br />The Stack is in reverse order, so we flip it (as in the original code)<br /><br /> Array.Reverse(password);<br /><br />But then we can use string.Join straight on the array:<br /><br /> string userPass = string.Join(string.Empty, password);Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-55282178392174464932011-07-15T12:50:07.838-07:002011-07-15T12:50:07.838-07:00Cool. Thanks for the Tip.Cool. Thanks for the Tip.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-18339392464558248942010-09-15T22:53:29.726-07:002010-09-15T22:53:29.726-07:00Thanks for this example. I am able to carry out my...Thanks for this example. I am able to carry out my task easily.Unknownhttps://www.blogger.com/profile/02213791639350935923noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-49110300030137866742010-02-04T11:33:42.048-08:002010-02-04T11:33:42.048-08:00But , you need to change your code : a cast of Obj...But , you need to change your code : a cast of Object[] to string[] is not possible but Object to string can be done. So can you add this code :<br /><br /> private static string[] Transform(object[] array)<br /> {<br /> string[] final = new string[array.Length];<br /><br /> for (int i = 0; i < array.Length; i++)<br /> {<br /> final[i] = (string)array[i];<br /> }<br /><br /> return final;<br /> }<br /><br />and modify string[] password = (string[])pass.ToArray();<br />to string[] password = Transform(pass.ToArray());<br /><br />Bay !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-92155099920342286922010-02-04T11:18:13.185-08:002010-02-04T11:18:13.185-08:00Thanks you ! that's perfect !Thanks you ! that's perfect !Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-62840451014088210552010-01-28T10:19:51.249-08:002010-01-28T10:19:51.249-08:00Where can I find that change set XSD??? It's n...Where can I find that change set XSD??? It's nowhere to be seen.Rebel1https://www.blogger.com/profile/05879656124196531337noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-85345664964894369852009-11-04T10:34:24.013-08:002009-11-04T10:34:24.013-08:00agreed! Very useful reference material.agreed! Very useful reference material.Jeremy Aryhttps://www.blogger.com/profile/09464189403179309983noreply@blogger.comtag:blogger.com,1999:blog-2736643499861726924.post-62942253027293017122009-08-19T10:19:49.023-07:002009-08-19T10:19:49.023-07:00Nice Notes!Nice Notes!salaboyhttps://www.blogger.com/profile/09494115977280470360noreply@blogger.com