System.ComponentModel.MarshalByValueComponent Class

Assembly: System.dll
Namespace: System.ComponentModel
Summary
Implements IComponent and provides the base implementation for remotable components that are marshaled by value (a copy of the serialized object is passed).
C# Syntax:
public class MarshalByValueComponent : IComponent, IDisposable, IServiceProvider
Remarks
A component can be contained in a container. For each component in a container, the container creates a site that it uses to manage the component. The component interacts with its container primarily through a container-provided ISite, which is a repository of container-specific, per-component information.

Notes to inheritors: When you inherit from this class, you can override the MarshalByValueComponent.Dispose, MarshalByValueComponent.Site, and the MarshalByValueComponent.GetService methods.
See also:
System.ComponentModel Namespace | ISite

System.ComponentModel.MarshalByValueComponent Member List:

Public Constructors
ctor #1 Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the MarshalByValueComponent class.
Public Properties
Container Read-only

Gets the container for the component.
DesignMode Read-only

Gets a value indicating whether the component is currently in design mode.
Site Read-write

Gets or sets the site of the component.
Public Methods
Dispose Overloaded:
Dispose()

Releases all resources used by the MarshalByValueComponent.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetService Gets the implementer of the IServiceProvider.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overridden:
Returns a String containing the name of the Component, if any. This method should not be overridden. For internal use only.
Public Events
Disposed Adds an event handler to listen to the MarshalByValueComponent.Disposed event on the component.
Protected Properties
Events Read-only

Gets the list of event handlers that are attached to this component.
Protected Methods
Dispose Overloaded:
Dispose(bool disposing)

Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources.
Finalize Overridden:
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.ComponentModel.MarshalByValueComponent Member Details

ctor #1
Summary
Initializes a new instance of the MarshalByValueComponent class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public MarshalByValueComponent();
Remarks
A component can be contained in a container. For each component in a container, the container creates a site that it uses to manage the component. The component interacts with its container primarily through a container-provided ISite, which is a repository of container-specific, per-component information.
See also:
MarshalByValueComponent

Return to top


Property: Container (read-only)
Summary
Gets the container for the component.
C# Syntax:
public virtual IContainer Container {get;}
Return Value:
An object implementing the IContainer interface that represents the component's container, or null if the component does not have a site.
See also:
MarshalByValueComponent | IContainer

Return to top


Property: DesignMode (read-only)
Summary
Gets a value indicating whether the component is currently in design mode.
C# Syntax:
public virtual bool DesignMode {get;}
Return Value:
true if the component is in design mode; otherwise, false.
Remarks
If the component does not have a site, this method always returns false.
See also:
MarshalByValueComponent

Return to top


Property: Events (read-only)
Summary
Gets the list of event handlers that are attached to this component.
C# Syntax:
protected EventHandlerList Events {get;}
See also:
MarshalByValueComponent | EventHandlerList

Return to top


Property: Site (read-write)
Summary
Gets or sets the site of the component.
C# Syntax:
public virtual ISite Site {get; set;}
Implements:
IComponent.Site
Remarks
A valid value for this property - that is, the value is not null, indicates that the component has been added to a container.

When the value of this property is null, the property indicates that the component is being removed from a container. However, this property does not remove the component from the container.



Notes to inheritors: To change this behavior, inherit from this class and get and set in this property.
See also:
MarshalByValueComponent | ISite

Return to top


Overloaded Method: Dispose()
Summary
Releases all resources used by the MarshalByValueComponent.
C# Syntax:
public void Dispose();
Implements:
IDisposable.Dispose
Remarks
Calling MarshalByValueComponent.Dispose allows the resources used by the MarshalByValueComponent to be reallocated for other purposes. For more information about MarshalByValueComponent.Dispose, see the conceptual topic at MSDN: cleaningupunmanagedresources.
See also:
MSDN: cleaningupunmanagedresources

Return to top


Overloaded Method: Dispose(
   bool disposing
)
Summary
Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources.
C# Syntax:
protected virtual void Dispose(
   bool disposing
);
Parameters:

disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks
This method is called by the public Dispose method and the Object.Finalize method.Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Object.Finalize invokes Dispose with disposing set to false.

When the disposing parameter is true, this method releases all resources held by any managed objects that this MarshalByValueComponent references. This method invokes the Dispose() method of each referenced object.



Notes to inheritors: Dispose can be called multiple times by other objects. When overriding Dispose(Boolean), be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. For more information about how to implement Dispose, see the conceptual topic at MSDN: implementingdisposemethod.

For more information about Dispose and Finalize, see the conceptual topic at MSDN: cleaningupunmanagedresources and the conceptual topic at MSDN: overridingfinalizemethod.

See also:
MSDN: implementingdisposemethod | MSDN: cleaningupunmanagedresources

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: Finalize()
Summary
Supports the Shared Source CLI infrastructure and is not intended to be used directly from your code
C# Syntax:
~MarshalByValueComponent();

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetService(
   Type service
)
Summary
Gets the implementer of the IServiceProvider.
C# Syntax:
public virtual object GetService(
   Type service
);
Parameters:

service

A Type that represents the type of service you want.

Return Value:
An Object that represents the implementer of the IServiceProvider.
Implements:
IServiceProvider.GetService
See also:
MarshalByValueComponent | IServiceProvider

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Returns a String containing the name of the Component, if any. This method should not be overridden. For internal use only.
This type supports the Shared Source CLI infrastructure and is not intended to be used directly from your code.
C# Syntax:
public override string ToString();
Return Value:
A String containing the name of the Component, if any.

null if the Component is unnamed.

Remarks
A Component may or may not have a name. If a Component is given a name, the name is unique among other Component objects within its IContainer.

The ISite stores the Component 's name. A Component can only have a ISite if it has been added to an IContainer and the IContainer assigns an ISite to it.

See also:
String | IContainer | Container | ISite

Return to top


Event: Disposed
Summary
Adds an event handler to listen to the MarshalByValueComponent.Disposed event on the component.
C# Syntax:
public event EventHandler Disposed;
See also:
EventHandler

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.