Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Cannot implicitly convert type 'availableEMIPlanType' to 'availableEMIPlanType[]'

What I have tried:

public availableEMIPlanType[][] availableEMIPlans
{
get
{
return this.availableEMIPlansField;
}
set
{
this.availableEMIPlansField = value;
}
}

public partial class availableEMIPlanType
{

public decimal eMIValueField;
public EMIPlanType eMIPlanField;
}

public getBTPlansResponse1 getBTPlans(getBTPlansRequest request)
{
EMIPlanType objEMIPlanType = new EMIPlanType();
objEMIPlanType.planCurrency= currencyCodeType.INR;
objEMIPlanType.planID="12";
objEMIPlanType.planName="asd";
objEMIPlanType.processingFee =12;
objEMIPlanType.rateOfInterest=12;
objEMIPlanType.tenureInMonths=34;

availableEMIPlanType objavailableEMIPlanType = new availableEMIPlanType();
objavailableEMIPlanType.EMIPlan = objEMIPlanType;
objavailableEMIPlanType.EMIValue = 123;

availableEMIPlanType[][] arravailableEMIPlanType = new availableEMIPlanType[1][];
arravailableEMIPlanType[0] = objavailableEMIPlanType;
}
Posted
Updated 17-Jul-17 21:36pm

1 solution

Look at your code:
availableEMIPlanType objavailableEMIPlanType = new availableEMIPlanType();
...
availableEMIPlanType[][] arravailableEMIPlanType = new availableEMIPlanType[1][];
arravailableEMIPlanType[0] = objavailableEMIPlanType;
}
objavailableEMIPlanType is not an array - it's an instance.
arravailableEMIPlanType is an array of arrays, so arravailableEMIPlanType[0] is an array.
Your code (simplified):
C#
int[][] a = new int[x][];
a[0] = 666;
You cannot assign an instance to a variable that expects an array of instances.
I'm not sure exactly what you are trying to do, but you need an array there, not an instance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900