Relative Content

Tag Archive for reflection

How do I cleanly keep track of the type of various objects implementing a common interface without reflection?

In my multiplayer game I have an inventory package that acts as a facade over a lower-level package. To abide by the Open-Closed Principle, I have a class for each inventory action, like PlaceAirplaneCommand and TurboTerminalCommand that extends the abstract InventoryItem with abstract classes in between that group these commands together. I then polymorphically call use() or lose() on the InventoryItem abstract class in my Inventory class which is the public API for the higher-level packages.

How do I identify the type of object without reflection in a game inventory system?

In my multiplayer game I have an inventory package that acts as a facade over a lower-level package. To abide by the Open-Closed Principle, I have a class for each inventory action, like PlaceRouteCommand and TurboTerminalCommand that extends the abstract InventoryItem with abstract classes in between that group these commands together. I then polymorphically call use() or lose() on the InventoryItem abstract class in my Inventory class which is the public API for the higher-level packages.

Should reflection be part of design?

I’m currently designing a somewhat large program that will involve the simulation of math/physics models and collection of data (I have not implemented any code yet). One of the main problems I’m facing is how to pass data around easily without having to have multiple copies of data (that may potentially be outdated and redundant).

Should reflection be part of design?

I’m currently designing a somewhat large program that will involve the simulation of math/physics models and collection of data (I have not implemented any code yet). One of the main problems I’m facing is how to pass data around easily without having to have multiple copies of data (that may potentially be outdated and redundant).

Should reflection be part of design?

I’m currently designing a somewhat large program that will involve the simulation of math/physics models and collection of data (I have not implemented any code yet). One of the main problems I’m facing is how to pass data around easily without having to have multiple copies of data (that may potentially be outdated and redundant).

Should reflection be part of design?

I’m currently designing a somewhat large program that will involve the simulation of math/physics models and collection of data (I have not implemented any code yet). One of the main problems I’m facing is how to pass data around easily without having to have multiple copies of data (that may potentially be outdated and redundant).

assembly.GetTypes() vs assembly.DefinedTypes.Select(t => t.AsType());

public static IEnumerable<Type> GetAccessibleTypes(this Assembly assembly) { try { #if NET40 return assembly.GetTypes(); #else return assembly.DefinedTypes.Select(t => t.AsType()); #endif } catch (ReflectionTypeLoadException ex) { // The exception is thrown if some types cannot be loaded in partial trust. // For our purposes we just want to get the types that are loaded, which are // […]

assembly.GetTypes() vs assembly.DefinedTypes.Select(t => t.AsType());

public static IEnumerable<Type> GetAccessibleTypes(this Assembly assembly) { try { #if NET40 return assembly.GetTypes(); #else return assembly.DefinedTypes.Select(t => t.AsType()); #endif } catch (ReflectionTypeLoadException ex) { // The exception is thrown if some types cannot be loaded in partial trust. // For our purposes we just want to get the types that are loaded, which are // […]