Vista available on MSDN and Visual Studio 2005 issues

by Sander Gerz November 17, 2006 08:10

It's out that Windows Vista has been made available for download for MSDN subscribers. For developers that are running Visual Studio 2005 on Vista, Microsoft has created a page listing all known issues:  http://msdn2.microsoft.com/en-us/vstudio/aa948853.aspx

This one caught my attention:

Title: Exception thrown when accessing FTP URL's

  • Description: When a user attempts to access a FTP URL Visual Studio calls getInputStream() and getContent() of URLConnection which results in it throwing java.io.IOException "The operation has timed out".
  • Work Around: None

 Notice the exception? Seems Microsoft is using Java without anyone finding out before. Now, who you're gonna blame? ;-)

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Wiki dedicated to Windows Workflow Foundation

by Sander Gerz November 15, 2006 13:43

Fellow MVP Maurice de Beijer recently launched a Wiki-based website on Windows Workflow Foundation (WF). Although I sometimes find wikis difficult to navigate, Maurice has managed to publish a significant amount of information. Here's a short list:

A wiki is all about joint content sharing, so if you've found some good resources on WF or are currently involved in a WF project, please share!

 

 

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Instantiating Generic Types at runtime

by Sander Gerz November 13, 2006 14:58

The Activator class is of good use when you want to instantiate classes at runtime. Here's a sample of how this works.

            Type t = Type.GetType("CompanyNameSpace.MyClass");

            Object o = Activator.CreateInstance(t);

Looks pretty easy. It gets a bit more interesting when you want to instantiate a generic type at runtime. First, we need to find out the fullname that is used for the generic type. If you don't know the string representation of a type,  you can create a small project using the type and then look at the type-properties in the debugger. As a sample, I'm using the following class:

    public class CustomerInfo

    {

        private string m_name;

 

        public string Name

        {

            get { return m_name; }

            set { m_name = value; }

        }

 

        private string m_city;

 

        public string City

        {

            get { return m_city; }

            set { m_city = value; }

        }

 

        public CustomerInfo(string name, string city)

        {

            m_name = name;

            m_city = city;

        }

    }

Let's use the Generic List type with this custom class, like this:

            List<CustomerInfo> list1 = new List<CustomerInfo>();

If you run the code and set a break point right after the the instantiation of list1, you can see the string representation of the list1's type:

"System.Collections.Generic.List`1[DemoGenerics.CustomerInfo]"

You see that the string contains  `1 and the type the List-object can contain. The 1 after the backtick (`) indicates the number of type parameters for the generic type. `1 means that the generic type has one parameter.

So, to get a Type object for this Generic type, we can use:

Type listType = Type.GetType("System.Collections.Generic.List`1[DemoGenerics.CustomerInfo]");

The next challenge is to instantiate the type and use the object in our code. We don't know the type of object at runtime, so we might use Object, but that's pretty awkward:

object o = Activator.CreateInstance(listType);

Since Object has limited capabilities, the compiler defaults to these limitations and we cannot do anything besides what Object can do. If we can assume that the type implements the generic IList<> interface, the compiler allows for us to use the methods and properties available in IList<>. Second, we can try to instantiate the generics class like this:

IList<object> list2 = (IList<object>)Activator.CreateInstance(listType);

At runtime, however, this will result in an InvalidCastException. This is obvious since object !=  CustomerInfo. A way to resolve this, is to specify an interface as the type parameter. This could be an empty interface, like:

    interface ICustomObject

    {

    }

We could then say that the custom class implements this interface:

public class CustomerInfo : ICustomObject

And by doing so, we can instantiate the Generics list, with a custom class, ehrr interface, parameter like this:

            Type listType = Type.GetType("System.Collections.Generic.List`1[DemoGenerics.ICustomObject]");

            IList<ICustomObject> list2 = (List<ICustomObject>)Activator.CreateInstance(listType);

 

            list2.Add(new CustomerInfo("Charles", "New York"));

            list2.Add(new CustomerInfo("Zlatan", "Sofia"));

            list2.Add(new CustomerInfo("Sujesh", "Bangalore"));     

There you go.

Happy coding. 

Currently rated 3.9 by 13 people

  • Currently 3.923077/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Interview with Damir Tomicic, INETA Europe

by Sander Gerz November 13, 2006 10:30

This year's TechEd in Barcelona, it was the first time I had a videocamera with me. A good opportunity to shoot some videos. Everyone seems to be doing this. The video below is a small interview with Damir Tomicic. He's the president of INETA Europe, the International .NET Association.

INETA Europe with Damir Tomicic
INETA Europe with Damir Tomicic

The camera used is a Panasonic SDR-S150. It's a good device, lightweight and easy to handle. Only downside is that the microphone is on top. This means that it recorded my voice quite prominently, but not Damir's. Sorry for that. I'll be publishing some more videos taken from the Speaker Idol contest at TechEd.

Currently rated 1.5 by 22 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

TechEd 2006 Barcelona : Pre-Conf

by Sander Gerz November 06, 2006 15:52

Yesterday, I arrived in Barcelona for the 2006 TechEd: Developers conference.

I'll be hovering around the ATE and community lounge area mostly, while trying to catch a session here and there.

Here's the first picture, showing the bag there giving out this year.

TechEd Bag

It's not a bad bag, although I prefer a rucksack.

I'm not sure how many attendees there are this year, and it's hard to compare since it's the first time the Europeand event is split into a week for developers and then a week for IT pros. It's kinda sad that it's split, because even as a developer I'd love to see new technology, tools, tips, tricks and best practices that relate to administration, like system center, MOM, etc. Also it's a chance to talk to eachother without the traditional wall between the two departments.

It's nice to finally meet Damir and the rest of the INETA Europe board team in person.

Currently rated 1.5 by 6 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio "Orcas" October CTP Available

by Sander Gerz November 01, 2006 08:07

Alex is discussing the September 2006 CTP of Visual Studio “Orcas” and ends with “The next CTP should bring more.”. Well, the next CTP is available. You'll see a number of improvements made compared to the last CTP. Here are a few that peeked my interest.Visual Studio Code Name “Orcas” CTP - Language Integrated Query

  • Enhanced the existing .Net Data Provider to work with the new features in ADO.Net 3.0 such as LINQ and object services;
  • Developers can build can create scripts as actual programs –instead of VBS scripts- that are still completely self-contained in a single file and can be trivially modified, compiled and executed in any environment that has .NET installed.
  • Core functionality of the XLinq API such as load, modify, and save XML documents
  • The current DateTime is insufficient at specifying an exact point in time. DateTimeOffset represents a date time with an offset. It is not meant to be a replacement for DateTime; it should be used in scenarios involving absolute points in time. DateTimeOffset includes most of the functionality of the current DateTime API and allows seamless conversion to DateTime as well.
  • HashSet is a new generic collection that has been added to the System.Collections.Generic namespace. It is an unordered collection that contains unique elements. In addition to the standard collection operations, HashSet provides standard set operations such as union, intersection, and symmetric difference.

It's a good thing these CTP's are made available as a VPC image. After downloading the image (and if you've not done so already, also the base) you only need to run it in Virtual PC or Virtual Server and you're all set.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen | Modified by Mooglegiant