Picking Up C# or How I typed my fingers to the bone
-
betterc wrote: But I really had to grin when I googled to find that to get my application path I needed to enter: string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); Environment.CurrentDirectory also gets the application path. It's a bit easier on the keyboard. :) betterc wrote: I think we need a contest on what is the longest statement possible in c# to retrieve a smiple result. There are 8 dots between the = sign and the ; in the above snippet. I once came across (alright, wrote :|) this code to decrypt a file:
string Decrypted = System.Text.ASCIIEncoding.ASCII.GetString(new System.Security.Cryptography.TripleDESCryptoServiceProvider().CreateDecryptor(System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["key"]).InnerText), System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["iv"]).InnerText)).TransformFinalBlock(System.Convert.FromBase64String(System.IO.File.OpenText(System.Configuration.ConfigurationSettings.AppSettings["filepath"]).ReadToEnd()), 0, System.Configuration.ConfigurationSettings.AppSettings["length"]));
Dan -
I'm an old guy. I've gone up the technical ranks to run a couple of significant software development groups; suffered the crash and now code for a living. I haven't coded in every programing language known, but then, I've got quite a few nothes on my pocket protector. I love C# but I don't think I've typed so much since the days of 'Big 8' COBOL. I get a chuckle on how much I have to type to get something so small done. I thought I'd seen everything when I found that a \n\r was replaced by an 'Environment.Linefeed'. But I really had to grin when I googled to find that to get my application path I needed to enter: string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); It works but I think I've only got another C# project before I'll need to replace my keyboard. I think we need a contest on what is the longest statement possible in c# to retrieve a smiple result. There are 8 dots between the = sign and the ; in the above snippet. :-D:-D:-D:-D
Pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee;P ************************** S r e e j i t h N a i r **************************
-
betterc wrote: But I really had to grin when I googled to find that to get my application path I needed to enter: string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); Environment.CurrentDirectory also gets the application path. It's a bit easier on the keyboard. :) betterc wrote: I think we need a contest on what is the longest statement possible in c# to retrieve a smiple result. There are 8 dots between the = sign and the ; in the above snippet. I once came across (alright, wrote :|) this code to decrypt a file:
string Decrypted = System.Text.ASCIIEncoding.ASCII.GetString(new System.Security.Cryptography.TripleDESCryptoServiceProvider().CreateDecryptor(System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["key"]).InnerText), System.Text.Encoding.ASCII.GetBytes(xdoc.SelectSingleNode(System.Configuration.ConfigurationSettings.AppSettings["iv"]).InnerText)).TransformFinalBlock(System.Convert.FromBase64String(System.IO.File.OpenText(System.Configuration.ConfigurationSettings.AppSettings["filepath"]).ReadToEnd()), 0, System.Configuration.ConfigurationSettings.AppSettings["length"]));
Dandnmanner wrote: Environment.CurrentDirectory also gets the application path. You really must learn the difference between the current directory and the application path. An application can set the current directory, it cannot set it's own path.
[
](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
-
So you use
House.Floor()
instead ofMath.Floor()
? ;P :rolleyes:Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
;P