password
type
status
date
slug
summary
tags
category
icon

问题:

如何快速判断某一变量是否属于一个类列表中类的任意之一?
 

解决方法:

  1. 使用System.type List做判断:
    1. csharp

      public List<System.Type> allowedTypes = new List<System.Type>(){typeof(EnemyBoss_WarMachine_1)}; .... if (IsNotTypeAllowed(target.GetType())) { break; } .... bool IsNotTypeAllowed(System.Type type) { return allowedTypes.Any(allowedType => allowedType.IsAssignableFrom(type)); }
      C#
 
读书笔记如何制作《魔法的终末》参展PV
白萧
白萧
一名懂一点程序、TA和绑定的小小策划 美术学习中!
公告
🎉欢迎你来到这里!!!🎉
请随意逛逛吧~
如果遇到了封面没加载出来,点击一下↗右上角的🏠首页即可加载.
↙左下角是▶️音乐播放器,如果想听可以听听看OUO
 
2023-2025 白萧.

白萧の港区 | 一名懂一点程序、TA和绑定的小小策划 美术学习中!

Powered by NotionNext 4.3.1.