• Exception classes
• TypeForwardedToAttributes class
I didn't finish off these last concepts in my previous post, so I will do them now.
The TypeForwardToAttribute class is not well documented. A search of MSDN returns no results! A search of both Google and Yahoo returns mostly results related to the certification, not the class itself. That is a shame. If this is such an important topic, they would have more on it. Is this one of those questions one must simply learn to pass a test? I hope not.
UPDATE - Microsoft's exam prep guide spells this wrong! The correct class name is TypeForwardToAttribute (without an 's' making it plural). That mistake distracted me for a couple of hours.
TypeForwardToAttribute allows you to move a type declaration to another assembly without disrupting users of a previous version of the assembly.As an example, if you had an assembly named Animal with a Dog class in it, but later decided to move the Dog class to a new assembly called Canine you could do that without impacting applications that refer to the Animal assembly when looking for the Dog class.
I stole this, so don't give me credit for this example:
- Move the type declaration to the new assembly
- In the old assembly, add a reference to the new assembly
- Add the following to the old assembly:
namespace Animal {
public class Dog {BECOMES
}
}
using System.Runtime.CompilerServices;
[assembly : TypeForwardedTo( typeof (Canine.Dog ) )]
namespace Animal
{
}YOU MUST ADD DOG CLASS TO THE CANINE ASSEMBLY
namespace Canine {
public class Dog {
}
}
TODO
• Attributes
• Exception classes
No comments:
Post a Comment