Questions tagged [reflection]

Reflection is the process by which a program can observe and modify its own structure and behavior at runtime.

Filter by
Sorted by
Tagged with
10 votes
3 answers
3k views

Converting between data and presentation types

Below is how I'm solving the problem of converting between data and presentation types, I'd like to know if that's a good way to go about it, and if not, what would be a better way to go about it. I ...
Mathieu Guindon's user avatar
10 votes
1 answer
261 views

Linq-to-Sage Implementation

Following-up on my last question where I wrapped the Sage API with a familiar IRepository interface, I decided to push the abstraction a step further, and... ...
Mathieu Guindon's user avatar
9 votes
1 answer
482 views

Change arbitrary arguments of function based on their names with a decorator

I ran across an issue that proved to be more complicated than I thought: Changing an arbitrary argument of a function purely based upon its name in Python - possibly via a decorator. I tried to ...
s-m-e's user avatar
  • 273
6 votes
2 answers
4k views

Custom enumeration classes

Lately I've been using a lot of enums in my project and the lack of generic Enum constraint seems to be quite problematic. This combined with few other headaches ...
Denis's user avatar
  • 8,448
6 votes
1 answer
2k views

Making TypeNameHandling in json.net more convenient

Handling abstract types in json.net can be sometimes challenging because it requires a very long and complex syntax like: ...
t3chb0t's user avatar
  • 44.2k
5 votes
1 answer
271 views

Setting up keyboard bindings using JSON and reflection

My game uses configuration files in JSON format. One of them is used for setting up control bindings, and it looks like this: ...
Big McLargeHuge's user avatar
5 votes
1 answer
4k views

Building a model-view-controller application in PHP

I've seen at least two recent PHP questions that would do well from a Model-View-Controller ('MVC' from here-on-out in this question) setup. Now, me, being the horrible person I am, I wanted to build ...
Der Kommissar's user avatar
10 votes
3 answers
2k views

Tracking Entity Changes (not EF)

So, I kept refactoring my Sage300 API wrapper - I wanted the client code to feel just like using Entity Framework - this is the closest I got to it: ...
Mathieu Guindon's user avatar
9 votes
2 answers
2k views

Optimize a generic foreach method that converts Datatable to my object using Reflection

I need to optimize this code block below, this method converts a Datatable object to the Object that I am passing by parameter, in another words, this serializes the object, however I have to run this ...
Roger Oliveira's user avatar
9 votes
1 answer
5k views

Variadic macro enum class "reflection" in C++11

I recently had the need of "reflecting" multiple enum class constructs in order to get their elements' names as std::string ...
Vittorio Romeo's user avatar
7 votes
1 answer
6k views

Serializing objects to delimited files

For a new project I'm going to need to be able to serialize random types to TSV or CSV files, so I write a class which can be used to serialize any object to a TSV, CSV or any other _SV file you can ...
Der Kommissar's user avatar
7 votes
1 answer
202 views

My EventBus system

I decided to roll out my own EventBus system which is intended to be thread-safe. Hence a review should focus extra on thread safety apart from all regular concerns. The ...
skiwi's user avatar
  • 10.6k
6 votes
3 answers
363 views

Calculating time windows for entities

I have made some code that operates on multiple entities and creates 'time windows' for them. Basically, the entities will contain states, usually in boolean or int. They will be timestamped and in ...
Mark Cilia Vincenti's user avatar
6 votes
2 answers
252 views

Building in the built-in declarations

In order for Rubberduck to be able to "recognize" the built-in VBA functions, procedures and objects, I added yet another constructor parameter to my Declaration ...
Mathieu Guindon's user avatar
6 votes
1 answer
77 views

Wrapping the Sage300 View API with... a Repository

Related: Something like a LINQ provider I needed to work with the Sage300 View API. I had never worked with it, but my first impression has been that the API is ...
Mathieu Guindon's user avatar
4 votes
1 answer
108 views

Immutable type updater using a special constructor

I wanted to update some properties of my UriString but since this type is immutable, it wouldn't work. Actually, I just wanted to update the Path property but I don'...
t3chb0t's user avatar
  • 44.2k
4 votes
3 answers
4k views

Accessing Properties by Name

Over the weekend I decided to start work on my own version of FastMember. I began with my take on an implementation of TypeAccessor so that I could work with the ...
Kittoes0124's user avatar
  • 1,940
3 votes
2 answers
399 views

Java Reflection-based CSV Parser

I'm an experienced Java developer, however I don't have experience with reflection or Annotation classes. For fun, I tried to develop a CSV Reader class which can parse each row into a particular type....
Richard Robinson's user avatar
3 votes
1 answer
97 views

Request handler based solely on reflections

The code itself is divided into 3 logical parts: Core modules (I call them Kernel modules, my love for Linux) - those are basic modules a web-developer would need, e.g. database wrapper class (PDO), <...
Kevin Kopf's user avatar
2 votes
3 answers
3k views

C# - exercise - object validation - reflection - generics

Just published (GitHub) a C# example for object Validation, for this purpose I decided to use the .NET Reflection and tried to use Generics. I would really like to improve coding, can you please give ...
Gae's user avatar
  • 31
2 votes
3 answers
637 views

Simple middleware pipeline builder (similar to asp.net-core)

I created a simple middleware pipeline builder that I want to use for my frameworks. It is similar to how ASP.NET-Core middleware works and uses the same conventions: A public constructor with a ...
t3chb0t's user avatar
  • 44.2k
1 vote
1 answer
97 views

Class showing a format similar to var_dump v1.0.5

First of all I must thank for the help given in the previous post: Class showing a format similar to var_dump RC5 Version I have it deployed in a early versio v1.0.5: https://github.com/arcanisgk/BOH-...
user avatar
1 vote
1 answer
55 views

Declarative DependencyProperety registration

Most properties have simple requirements so it should be possible to register their Dependency Property fields declaratively. I made a small experiment and it seems to work just fine. The first ...
t3chb0t's user avatar
  • 44.2k
1 vote
1 answer
4k views

Custom Exception.ToString() formatter

I find the default Exception.ToString() formattig very difficult to read especially if there are inner exceptions involved. I guess everyone knows how it looks: <...
t3chb0t's user avatar
  • 44.2k