Skip to content

Instantly share code, notes, and snippets.

@mzaks
Last active October 11, 2015 09:48
Show Gist options
  • Select an option

  • Save mzaks/123bd2cff59cebc5973a to your computer and use it in GitHub Desktop.

Select an option

Save mzaks/123bd2cff59cebc5973a to your computer and use it in GitHub Desktop.
Find all Entitas-CSharp Component classes in a Xamarin Project
var componentTypes = new HashSet<string>();
foreach (var type in doc.Compilation.MainAssembly.TopLevelTypeDefinitions){
foreach (var parentType in type.DirectBaseTypes) {
if (parentType.FullName == "Entitas.IComponent"){
var name = type.FullName;
if(name.EndsWith("Component")){
// names should contain component name without Component sufix.
name = name.Substring(0, name.Length - "Component".Length);
}
componentTypes.Add(name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment