I am writing a TwoWay Binding control for ASP.NET. I finally got things working. I'm rebinding using the following code:
private void RebindData()
{
// return if the DataValue wasn't loaded from ViewState
if (DataValue == null)
return;
// extract the values from the two-way binding template
IOrderedDictionary v...
Context: .NET 3.5, VS2008. I'm not sure about the title of this question, so feel free to comment about the title, too :-)
Here's the scenario: I have several classes, say Foo and Bar, all of them implement the following interface:
public interface IStartable
{
void Start();
void Stop();
}
And now I'd like to have a contai...
Hi there,
DOes anyone have any good information with regards to when to log, I was thinking of logging an INFO type when i enter each c# method and recording another info when exiting..
Is this considered good or bad? Will i see a performance hit?
If i do record an INFO when i enter a method, the idea would be to record the method nam...
Due to politics at the very large finanial institution for which I work, I am not able to use Castle Project's ActiveRecord implementation, but like the pattern so much I have implemented it myself. This is complete, and now management is looking for a GUI tool to browse all the activerecord classes, search for instances and manage data....
Can the value of a Java static final class variable be retrieved through reflection?
...
Heres my problem:
I have 2 projects - one 'common' projects with acts like a library with all kinds of support code, and the actual program that uses said project in many of its calls. We'll call these projects "Common" and "Program". They are both in the same solution.
Within "Common", I have a class for commo reflection tasks, like...
Hi, everyone. This is my very first question in SO.
I've been working for years with Java. During those years, I've made extensive (or maybe just frequent) use of Reflection, and found it useful and enjoyable. But 8 months ago I changed my job, and now Java is just a memory, and I'm getting my hands on C++. So now I'm wondering if there...
I have an instance that implements IDictionary<T, K>, I don't know T and K at compiletime, and want to get all elements from it. I don't want to use IEnumerable for some reason, which would be the only non-generic interface implemented by IDictionary.
Code I have so far:
// getting types
Type iDictType = instance.GetType().GetInterface...
Hi all,
I had created a framework for a project in the past that one of it’s functionalities was to load the Database info into my business entity classes (only properties no methods) and from the Business entity classes to the database loading the parameters collection of the stored procedure to be executed. To this on that project I d...
I'm am trying to add event handlers to 'myObject' based on the name of an event or events.
'myObject' has an event called 'MyEvent' and I have a public event handler called 'MyEventHandler' (which I don't need to get by name but do it below to get a MethodInfo).
This is what I have so far:
EventInfo eventInfo = myObject.GetType().GetEv...
Please bear with me if this question isn't well formulated. Not knowing is part of the problem.
An example of what I'd like to accomplish can be found in PropertyChangedEventArgs in WPF. If you want to flag that a property has changed in WPF, you do it like this:
PropertyChanged(this, new PropertyChangedEventArgs("propertyName"));
Yo...
I am having trouble getting a nested objects properties. For the example I am working with, I have 2 Classes:
public class user
{
public int _user_id {get; set;}
public string name {get; set;}
public category {get; set;}
}
public class category
{
public int category_id {get; set;}
public string name {get; set;}
}
Simple ...
When you write an iterator function in C#, using yield syntax, the compiler internally translates your function into a class. So, if I write something like this:
IEnumerator<int> MyIterator () {
for (int i = 0; i < 10; i++)
yield return i;
}
Invoking MyIterator() constructs a class with a private field for i, instead of using a ...
Hi,
I am using reflection to populate the properties of an object.
These properties have different types: String, Nullable(double) and Nullable(long) (don't know how to escape the angle brackets here ...). The values for these properties are coming from a dictionary of (string, object) pairs.
So, for example my class has the followin...
What exactly is Reflection?
I read the Wikipedia article on this subject and I understand that it is a kind of meta-programming, where the program can modify itself at run-time, but what does this mean?
In what kind of situations is this a good approach and when is it the best to use it?
...
When I have an object foo, I can get it's class object via
str(foo.__class__)
What I would need however is only the name of the class ("Foo" for example), the above would give me something along the lines of
"<class 'my.package.Foo'>"
I know I can get it quite easily with a regexp, but I would like to know if there's a more "clean...
(update) ICustomTypeDescriptor works for my Windows Forms app, but not for Silverlight; Not supported. I will keep investigating this idea though and see where i get to.
(/update)
I have, say a few switch panels (for those that like analogies).
Each of these switch panels has switches that have a Name(string) can be in state(bool) of On...
I need to compare dozens of fields in two objects (instances of the same class), and do some logging and updating in case there are differences. Meta code could look something like this:
if (a.getfield1 != b.getfield1)
log(a.getfield1 is different than b.getfield1)
b.field1 = a.field1
if (a.getfield2!= b.getfield2)
log(a.getfield...
I'm using MEF. I serialize one of the objects which relies on one of the loaded assemblies.
Now when I try to deserialize this object it throws "Unable to find assembly" exception. MEF loads the assemblies before this deserialization in another class (I assume that the scope of this is application wide, it loads them into a public prop...
Is it possible to see which constructor was the generic one?
internal class Foo<T>
{
public Foo( T value ) {}
public Foo( string value ) {}
}
var constructors = typeof( Foo<string> ).GetConstructors();
The property 'ContainsGenericParameters' returns me for both constructors false. Is there any way to find out that constructors[0...