问题描述
限时送ChatGPT账号..这个问题与另一个问题有关 我问的我有这个 web 服务,它返回一个类,它本身有一个类列表.当我尝试调用该方法时,抛出以下异常:
This question is tied in with this other question that I asked I have this webservice that returns a class that within itself has a list of classes. When I try to call the method the following exception is being thrown:
System.InvalidOperationException:类型YambushiDataClass.SCharacterProjectile没想到.
System.InvalidOperationException: The type YambushiDataClass.SCharacterProjectile was not expected.
这是它说它没有expect
的类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace YambushiDataClass
{
public class SCharacterProjectile : SProjectile
{
public int? characterProjectileId { get; set; }
public string projectileName { get; set; }
public int? characterId { get; set; }
}
}
推荐答案
在 2 天后我的大脑试图解决问题显然我试图填充列表 public List
类型为 SCharacterProjectile 的继承自 SProjectile 因此无法序列化
After 2 days bashing my brain in trying to solve the problem apparently I tried to fill the list public List<SProjectile> projectileList = new List<SProjectile>();
with type SCharacterProjectile which inherits from SProjectile therefore could not be serialized
这篇关于c# System.InvalidOperationException: 类型 foo 不是预期的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论