Archive

Posts Tagged ‘c#’

Microsoft releases VS2010 SP1 & TFS 2010 SP1

March 9th, 2011 1 comment

The moment most of us have been waiting for, Visual Studio 2010 Service Pack 1 is finally out (right now for MSDN Subscribers), read what the changes are in VS2010 Service Pack 1 (or TFS 2010 SP1 Changes) and grab it from MSDN – once the links become public will update this post.

File Name: mu_visual_studio_2010_sp1_x86_x64_dvd_651704.iso [MSDN Download Link]
Size: 1.56Gb
SHA1: 61C2088850185EDE8E18001D1EF3E6D12DAA5692
ISO/CRC: C77C2A14
Date Published (UTC): 3/8/2011 9:13:36 AM
Last Updated (UTC): 3/8/2011 10:20:52 AM

There’s also the TFS Project Server Integration Feature Pack that’s been released.

Support for Silverlight 4 and Razor, SQL CE4, IIS Express and 64bit IntelliTrace are amongst the finer things in SP1. For C++ folks, the support for Intel AVX and AMD Bulldozer instruction sets are going to be interesting 😀

Some notable bugfixes:

Enjoy!

{lang: 'en-GB'}
Share

QuickTip: Mapping your GAC folder in Windows with Subst

December 30th, 2010 1 comment

Here’s a quick tip if you want to browse the files in your GAC easily without messing about with commands all the time. Map the folder  containing the assemblies with the Subst command.

To do that, bring up a console window (Windows Key + R or Start > Run), then:

subst G: C:\windows\Assembly

This will map the Global Assembly Cache folder to your G drive in Windows Explorer. You can also peek around and see how the GAC works.

The folders you’ll find in the mapped drive include – on a 64bit system *:

  • GAC – Non-native assemblies used by .NET 1.x
  • GAC_32 – Non-native 32bit assemblies
  • *GAC_64 – Non-native 64bit assemblies visible only on 64bit Windows.
  • GAC_MSIL – Non-native MSIL (AnyCPU) assemblies.
  • NativeImages_v* – Native assemblies for the framework version and the architecture (Eg. NativeImages_v4.0.30319_64 is for the .NET 4.0 64bit native Assemblies)
  • temp / tmp – Temporary directories (duh!)

To remove the binding, use the Subst command with the -D option.

subst G: /D

That’s it! Have a safe & happy New Year!

{lang: 'en-GB'}
Share

DOOM: Bill Gates introduces DirectX in 1995.

November 17th, 2010 No comments

Here’s something you wouldn’t see every day. Bill Gates introducing the world to DirectX in 1995.

httpv://www.youtube.com/watch?v=_JokM_fExpI

Don’t interrupt him! My how things have changed.

{lang: 'en-GB'}
Share

Windows Phone 7 Developer Tools Released!

September 17th, 2010 No comments

The moment we’ve all been waiting for, the final release of the Windows Phone 7 SDK has been released! What are you waiting for, go download it and try out some cool things!

No Visual Studio installed? Not an issue, it comes with the Express edition of VS2010 and Expression Blend 4 for Windows Phone as well as XNA and Silverlight tools for Windows Phone and an emulator – all for free too!

For more information, see ScottGu’s great post about it!

{lang: 'en-GB'}
Share

Moving to Microsoft Visual Studio 2010 free ebook!

September 15th, 2010 No comments

Microsoft Press - Moving to Microsoft Visual Studio 2010Free ebook compliments of Microsoft Press, you can download a PDF. or an XPS of the book and grab the book’s sample code.

The book is broken down into these parts  catering for the following audiences:

  • Part I – for those moving from Visual Studio 2003 to Visual Studio 2010.
  • Part II – for developers moving from Visual Studio 2005.
  • Part III – for developers moving from Visual Studio 2008.

See the blog post about the target audience for this ebook too.

{lang: 'en-GB'}
Share

Channel9: Windows Phone 7 Jump Start

September 14th, 2010 No comments

With the release of the final Windows Phone 7 SDK just days away, now’s the time to get into understanding the concepts, architecture & development side of Windows Phone 7. There’s an interesting series posted on Channel 9 to hep you get there.

This Windows Phone 7 Jump Start video training is for all developers interested in developing applications or games for the new Windows Phone 7 Platform.  The course is based on the Microsoft Windows Phone 7 Developer Training Kit and taught by Microsoft MVP’s and Microsoft Press Authors, Andy Wigley and Rob S. Miles.  Watch these entertaining sessions and complete the labs found on Channel 9 (http://channel9.msdn.com/learn/courses/WP7TrainingKit/) to gain development skills using both XNA and Silverlight. For copies of the student files and links to demo code, you can go to the Windows Phone 7 Born To Learn Forum (http://borntolearn.mslearn.net/wp7/m/classresources/default.aspx).

Enjoy – the ! I’ll be posting about my own adventures soon!

{lang: 'en-GB'}
Share

Ninject 2.0 is out, now with more ninja!

February 27th, 2010 1 comment

Nate Kohari (the head Ninja of Ninject) has announced the availability of Ninject 2.0 which has been a long time coming – being a complete rewrite. The sources are on  github repository. Oh and checkout the new website, its got more ninja references that you can poke a ninja with!

As for .NET 4.0 compatibility,  whilst not officially announced, we’ve been using Ninject 2.0 (betas) and now just moving to the final release with .NET 4.0 without issues. All documentation and material are available on the wiki however.

{lang: 'en-GB'}
Share

Microsoft Visual Studio 2010 Release Candidate

February 12th, 2010 No comments

It seems every year life just keeps getting busier 🙁 Anyway, here’s a bit good of news, the Visual Studio 2010 Release Candidate is available for download now. You can also get one chunky ISO if that tickles your fancy.

Compared to Beta 2, its a smooth and quite enjoyable experience and I’m very much waiting for the final. The performance of this release is insanely good and finally fixes some annoying performance issues we noticed in WPF in Beta 2 (lets forget Beta 1).

Don’t forget to try some of the cooler features of .NET 4.0 too.

{lang: 'en-GB'}
Share

InvokeRequired with anonymous delegates for threading in WinForms!

September 12th, 2009 2 comments

Here’s a little cookie from the cookie jar. To quote the legendary Jon Skeet from Threading with Windows Forms:

There are two different ways of invoking a method on the UI thread, one synchronous (Invoke) and one asynchronous (BeginInvoke). They work in much the same way – you specify a delegate and (optionally) some arguments, and a message goes on the queue for the UI thread to process. If you use Invoke, the current thread will block until the delegate has been executed. If you use BeginInvoke, the call will return immediately. If you need to get the return value of a delegate invoked asynchronously, you can use EndInvoke with the IAsyncResult returned by BeginInvoke to wait until the delegate has completed and fetch the return value.

Here’s a simple, uncluttered version you can utilise and reuse – this example just adds a list item to the listview.

        public void Add(ListViewItem item)
        {
            if (m_ListView.InvokeRequired)
            {
                m_ListView.BeginInvoke(new MethodInvoker(() => Add(item)));
            }
            else
            {
                m_ListView.Items.Add(item);
            }
        }

First we check whether we’re executing on the GUI thread or not (InvokeRequired), then execute a delegate thats parsed into the MethodInvoker calling itself using a lambda expression. This code is VS2008 compatible (.NET 2.0 +).

For a non lambda version:

      
        public void Add(ListViewItem item)
        {
            if (m_ListView.InvokeRequired)
            {
                m_ListView.BeginInvoke(new MethodInvoker(delegate
                                                             {
                                                                 Add(item);
                                                             }));
            }
            else
            {
                m_ListView.Items.Add(item);
            }
        }

The advantage of using an anonymous delegate is that by design, delegates are able to use local variables and parameters scoped in the containing method. Therefore we didn’t need to create a custom delegate with the signature to pass onto the method.

{lang: 'en-GB'}
Share

Quick Tip: Converting an Enum from a string using C# Generics

August 3rd, 2009 No comments

Here’s a quick tip for you. Converting a string back to an Enum using Generics in C#.

private static T ToEnum<T>(string value)
{
	return (T) Enum.Parse(typeof(T), value);
}

Nice and easy, here’s an example usage – very lame I know.

// Original enum
UriFormat uriFormat = UriFormat.SafeUnescaped;
// Persisted value
string uriFormatText = uriFormat.ToString();
// Back to the enum from the persisted value
UriFormat uriFormatParsed = ToEnum<UriFormat>(uriFormatText);

Console.WriteLine(uriFormat);
Console.WriteLine(uriFormatText);
Console.WriteLine(uriFormatParsed);

Another juicy tidbit is coming, hang in there.

{lang: 'en-GB'}
Share