grab our rss feed

stevienova.com

Homepage of Steve Novoselac

Entries Tagged ‘C#’

C# 3.0 Features - Extension Methods

C# 3.0 and .NET 3.5 are out and ready for consumption, and I have been using some of the new features. One of the new features, Extension Methods, is really cool and can help you consolidate and reuse your code in a logical manner. Take for example, System.Data.DataSet - there is always something I do [...]

Comments (1) | 516 views

C# .NET Test Driven Development with Visual Studio 2005

As of late I have been stuck in C++ world. MFC/Win32, pointers and HRESULT’s. Ugh. Earlier this week I got a chance to get back to C# and .NET (aka My Roots).
I needed to create a class library for a project, basically from scratch, since there was no existing library created. I started to go [...]

Leave a Comment | 237 views

ASP.NET C# - Grabbing a posted file and save to disk

Sometimes you want to grab a file posted to a page, maybe an image upload or other file upload
HttpFileCollection logFiles = Request.Files;
string path = System.Configuration.ConfigurationManager.AppSettings["LogPath"];
if (logFiles.Count > 0)
{
HttpPostedFile logFile = logFiles.Get(0);
logFile.SaveAs(path + System.Guid.NewGuid().ToString() + “.log”);
}
As you can see, I am setting the log path from the config. The reason for this is, the path to [...]

Comments (2) | 182 views

Careful! rand_s and OS compatability

if you want to use the secure version rand_s() - be careful, it only works on XP and higher!!

http://msdn2.microsoft.com/en-us/library/sxtz2fa8(VS.80).aspx
Guess you don’t get to be secure on Windows 2000 or lower. :P

Leave a Comment | 318 views