편집

다음을 통해 공유


ContractDescription.GetContract Method

Definition

Returns the contract description for a specified type of contract.

Overloads

GetContract(Type, Type)

Returns the contract description for a specified type of contract and a specified type of service.

GetContract(Type, Object)

Returns the contract description for a specified type of contract and service implementation.

GetContract(Type)

Returns the contract description for a specified type of contract.

Remarks

The difference between the GetContract overloads is that the ones with two arguments allow you to find attributes from the service (for example, OperationBehaviorAttribute).

GetContract(Type, Type)

Source:
ContractDescription.cs
Source:
ContractDescription.cs

Returns the contract description for a specified type of contract and a specified type of service.

public:
 static System::ServiceModel::Description::ContractDescription ^ GetContract(Type ^ contractType, Type ^ serviceType);
public static System.ServiceModel.Description.ContractDescription GetContract (Type contractType, Type serviceType);
static member GetContract : Type * Type -> System.ServiceModel.Description.ContractDescription
Public Shared Function GetContract (contractType As Type, serviceType As Type) As ContractDescription

Parameters

contractType
Type

The Type of contract.

serviceType
Type

The Type of service.

Returns

The ContractDescription for the specified type of contract and type of service.

Examples

ContractDescription cd4 = ContractDescription.GetContract(typeof(ICalculator), typeof(CalculatorService));
Dim cd4 As ContractDescription = ContractDescription.GetContract(GetType(ICalculator), GetType(CalculatorService))

Remarks

The difference between the GetContract overloads is that the ones with two arguments allow you to find attributes from the service (for example, OperationBehaviorAttribute).

Applies to

GetContract(Type, Object)

Source:
ContractDescription.cs
Source:
ContractDescription.cs

Returns the contract description for a specified type of contract and service implementation.

public:
 static System::ServiceModel::Description::ContractDescription ^ GetContract(Type ^ contractType, System::Object ^ serviceImplementation);
public static System.ServiceModel.Description.ContractDescription GetContract (Type contractType, object serviceImplementation);
static member GetContract : Type * obj -> System.ServiceModel.Description.ContractDescription
Public Shared Function GetContract (contractType As Type, serviceImplementation As Object) As ContractDescription

Parameters

contractType
Type

The Type of contract.

serviceImplementation
Object

The Object that implements the service.

Returns

The ContractDescription for the specified type of contract and service implementation.

Examples

CalculatorService calcSvc = new CalculatorService();
ContractDescription cd3 = ContractDescription.GetContract(typeof(ICalculator), calcSvc);
Dim calcSvc As New CalculatorService()
Dim cd3 As ContractDescription = ContractDescription.GetContract(GetType(ICalculator), calcSvc)

Remarks

The difference between the GetContract overloads is that the ones with two arguments allow you to find attributes from the service (for example, OperationBehaviorAttribute).

Applies to

GetContract(Type)

Source:
ContractDescription.cs
Source:
ContractDescription.cs

Returns the contract description for a specified type of contract.

public:
 static System::ServiceModel::Description::ContractDescription ^ GetContract(Type ^ contractType);
public static System.ServiceModel.Description.ContractDescription GetContract (Type contractType);
static member GetContract : Type -> System.ServiceModel.Description.ContractDescription
Public Shared Function GetContract (contractType As Type) As ContractDescription

Parameters

contractType
Type

The Type of contract.

Returns

The ContractDescription for the specified type of contract.

Examples

ContractDescription cd2 = ContractDescription.GetContract(typeof(ICalculator));
Dim cd2 As ContractDescription = ContractDescription.GetContract(GetType(ICalculator))

Remarks

The difference between the GetContract overloads is that the ones with two arguments allow you to find attributes from the service (for example, OperationBehaviorAttribute).

Applies to