无法将类型'availableemiplantype'隐式转换为'availableemiplantype []' [英] Cannot implicitly convert type 'availableemiplantype' to 'availableemiplantype[]'
问题描述
无法将类型'availableEMIPlanType'隐式转换为'availableEMIPlanType []'
我尝试过:
公开发售EMIPlanType [] [] availableEMIPlans
{
get
{
返回this.availableEMIPlansField;
}
set
{
this.availableEMIPlansField = value;
}
}
公共部分类可用EMIPlanType
{
公共小数eMIValueField;
公共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 ;
}
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;
}
推荐答案
查看你的代码:
Look at your code:
availableEMIPlanType objavailableEMIPlanType = new availableEMIPlanType();
...
availableEMIPlanType[][] arravailableEMIPlanType = new availableEMIPlanType[1][];
arravailableEMIPlanType[0] = objavailableEMIPlanType;
}
objavailableEMIPlanType
不是数组 - 它是一个实例。
arravailableEMIPlanType
是一个数组数组,所以arravailableEMIPlanType [0]是一个数组。
你的代码(简化):
objavailableEMIPlanType
is not an array - it's an instance.
arravailableEMIPlanType
is an array of arrays, so arravailableEMIPlanType[0] is an array.
Your code (simplified):
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.
这篇关于无法将类型'availableemiplantype'隐式转换为'availableemiplantype []'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!