c# System.InvalidOperationException: 类型 foo 不是预期的

编程入门 行业动态 更新时间:2024-10-23 22:22:14
本文介绍了c# System.InvalidOperationException: 类型 foo 不是预期的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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 ListprojectileList = new 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:关键词]

本文发布于:2023-04-26 06:07:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1130521.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   System   InvalidOperationException   foo

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!