Home > Articles > Programming > Windows Programming

Windows Communication Foundation 3.5: Prerequisites

  • Print
  • + Share This
This chapter introduces some programming tools that were new in .NET 2.0 and that are prerequisites for understanding and working effectively with the Windows Communication Foundation, including partial types, generics, nullable value types, the Lightweight Transaction Manager, and role providers.
This chapter is from the book

IN THIS CHAPTER

  • Partial Types
  • Generics
  • Nullable Value Types
  • The Lightweight Transaction Manager
  • Role Providers

To properly understand and work effectively with the Windows Communication Foundation, you should be familiar with certain facilities of the 2.0 versions of the .NET Framework and the .NET common language runtime. This chapter introduces them: partial types, generics, nullable value types, the Lightweight Transaction Manager, and role providers. The coverage of these features is not intended to be exhaustive, but merely sufficient to clarify their use in the chapters that follow.

Partial Types

Microsoft Visual C# 2005 allows the definition of a type to be composed from multiple partial definitions distributed across any number of source code files for the same module. That option is made available via the modifier partial, which can be added to the definition of a class, an interface, or a struct. Therefore, this part of the definition of a class

public partial MyClass
{
      private string myField = null;

      public string MyProperty
      {
            get
            {
                  return this.myField;
            }
      }
}

and this other part

public partial MyClass
{
      public MyClass()
      {
      }

      public void MyMethod()
      {
        this.myField = "Modified by my method.";
      }
}

can together constitute the definition of the type MyClass. This example illustrates just one use for partial types, which is to organize the behavior of a class and its data into separate source code files.

  • + Share This
  • 🔖 Save To Your Account