Skip to content

Do not crash if generic class has inner class#98

Open
goyusia wants to merge 6 commits into
vexe:masterfrom
goyusia:master
Open

Do not crash if generic class has inner class#98
goyusia wants to merge 6 commits into
vexe:masterfrom
goyusia:master

Conversation

@goyusia

@goyusia goyusia commented Oct 22, 2016

Copy link
Copy Markdown

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