Skip to content

Comments

Do not crash if generic class has inner class#98

Open
if1live wants to merge 6 commits intovexe:masterfrom
if1live:master
Open

Do not crash if generic class has inner class#98
if1live wants to merge 6 commits intovexe:masterfrom
if1live:master

Conversation

@if1live
Copy link

@if1live if1live commented Oct 22, 2016

Example code

using UnityEngine;
using System;
using System.Collections.Generic;
using Vexe.Runtime.Types;

[Serializable]
public class ProiorityList<T> {
    [Serializable]
    public class Pair {
        public T elem;
        public int priority;
    }
    public List<Pair> pairs = new List<Pair>();
}
public class TestScript : BaseBehaviour {
    public ProiorityList<Vector3> proiorityList = new ProiorityList<Vector3>();
}

Description

Somtimes, type.Name doesn't contains ```.
In example code, ...

  • type: VFWExamples.ProiorityList`1[UnityEngine.Vector3]
    • type.Name: ProiorityList`1
  • type: System.Collections.Generic.List1[VFWExamples.ProiorityList1+Pair[UnityEngine.Vector3]]
    • type.Name: List`1
  • type: VFWExamples.ProiorityList`1+Pair[UnityEngine.Vector3]
    • type.Name: Pair

if name doesn't contains ```, IndexOf function return -1. I use it.

example code

[Serializable]
public class ProiorityList<T> {
    [Serializable]
    public class Pair {
        public T elem;
        public int priority;
    }
    public List<Pair> pairs = new List<Pair>();
}
public class TestScript : BaseBehaviour {
    public ProiorityList<Vector3> proiorityList = new ProiorityList<Vector3>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant