CServiceParameter oCustomer_in = oCustomerDetails_in.ServiceParameterList.Find(delegate(CServiceParameter oTargetParameter) { return oTargetParameter.ParameterName == "Enum"; }) ?? new IACustomermanager.CommonObjects.CServiceParameter()
and i have a request that require 2 Parameters one of them is type Enum e.g 333,444.555
but when i try to add the requested parameters as follow
MyService.MyMethod oCustomerDetailsRequest = new MyService.MyMethod { CSUID = Convert.ToString(oCustomerRefParameter), SaleBase =oCustomerSalesBase_in };
it do complain about converting oCustomerSalesBase_in as it requires an Enum type
the question how can i convert this parameter to return an Enum type
yhank you in advance
Jaganathan BantheswaranPosted Dec 11, 2013, 6:25 AM
First you try to convert the parameter like,
YourEnum enumValue;
if (!Enum.TryParse(oCustomerSalesBase_in, true, out enumValue))
{
enumValue = YourEnum.DefaultValue;
}
MyService.MyMethod oCustomerDetailsRequest = new MyService.MyMethod { CSUID = Convert.ToString(oCustomerRefParameter), SaleBase =enumValue };
Abbas HamzaPosted Dec 11, 2013, 2:13 AM
SaleBase is int defined as enum
oCustomerSalesBase_in is a parameter typepe of salesBase required by my method
I have data contract defined as Parameterlist to get any type of parameter which add parameter when calling wcf service which some time don't know about the parameter type of the wcf method parameter type
it is defind as string
when called define the parameter list you cast your parameter list to the wcf service type parameter
Hopefully that explain it
thank you
Jaganathan BantheswaranPosted Dec 11, 2013, 12:36 AM
What is the types of these properties?
SaleBase, oCustomerSalesBase_in