I am trying to create a SortedList of property names and values for any object. The two methods below iterate an object's properties storing its respective values in a sorted list (if there is a better mechanism for accomplishing this please recommend it).
With my current implementation I am running into issues with Index Properties. Ob...
I need a function that will convert a type to a string, for example:
Dim foo as Dictionary(of Dictionary(of Integer, String), Integer)
Debug.WriteLine(TypeToString(GetType(foo)))
In the debug output, I'd expect to see something equivalent to:
Dictionary(of Dictionary(of Integer, String), Integer)
...
hi there
I am writing a program and I have some class that doesn't extend any class.
I want to know if dynamic inheritance at runtime is possible. I mean if one or more classes can derive from a class at runtime.
...
Let's say I have a regular simple Java class, such as:
public class Foo {
private int data;
public int getData() {
return data;
}
public void setData(int data) {
this.data = data;
}
}
...and I now wish to, retroactively (i.e. without changing Foo's implementation), do some magic so that I can moni...
Isn't it possible to treat functions in Scheme as any other list?
Basically, what I want do to is something like this:
(define (foo) "hello")
(cdr foo) ; or similar, should return the list ((foo) "hello")
I've found a similar discussion about this, and I feel a bit disappointed if this is not possible with Scheme. If so, why is th...
Hi everyone,
I have managed to use the reflection sample app from apple to create a reflection from a UIImageView.
But the problem is that when I change the picture inside the UIImageView, the reflection from the previous displayed picture remains on the screen. The new reflection on the next picture then overlaps the previous reflecti...
I want to get type of TKey and TValue given a Dictionary<TKey,TValue> type.
eg. If type is Dictionary<Int32,String> I want to know how to get
keyType = typeof(Int32) and
valueType = typeof(String)
...
I would like to do something like this:
public MyFunction(int integerParameter, string stringParameter){
//Do this:
LogParameters();
//Instead of this:
//Log.Debug("integerParameter: " + integerParameter +
// ", stringParameter: " + stringParameter);
}
public LogParameters(){
//Look up 1 level in the ...
Im trying to build an error-logger that loggs running values that is active in the function that caused the error. (just for fun so its not a critical problem)
When going in break-mode and looking at the locals-tab and autos-tab you can see all active variables (name, type and value), it would be useful to get hold of that for logging ...
Hi,
How can I invoke a method with parameters using reflections?
I want to the values to those parameters. Can somebody help?
...
I have a String which has a name of a class say "Ex" (no .class extension). I want to assign it to a Class variable, like this:
Class cls = (string).class
How can i do that?
...
Hi,
i want to access or get the class which is present in different project.How can i do that?Help
Actually the using reflections i want to access a class from different package.
Class class="class from another project"
...
I have a interface resembling the following:
public IEnumerable<IDocument> Search(Predicate<IDocument> predicate) { ... }
where an IDocument looks like this:
public interface IDocument
{
string Id {get; set;}
string Title {get; set;}
...
}
I am about to implement a document provider where I have to decompose the conten...
Hello
Can we call COM exposed interface METHODS at runtime one by one. This can be achieved in case of WIN32 DLL's using reflections. But SAME job need to be done with COM Dll or COM EXE, We'll be able to view all exposed methods of that COM DLL or COM EXE and ony by one we need to call all of them.(Remember I need to call unmanaged cod...
a) Can Object.GetType also be used for late binding ( Book I’m reading says it can’t be used for late-binding )?
For example, assuming we use late binding ( by dynamically loading an assembly A, calling A.GetType(“T”) and then calling Activator.CreateInstance) to create an instance (I) of type (T) not known at compile time and if we t...
Currently I am doing this:
I have text that looks like:
Hello ${user.name}, this is ....
And I do this:
public string TransformUser(User user, string text)
{
StringBuilder sb = new StringBuilder(text);
sb.Replace("${user.name}", user.Name);
...
...
return sb.ToString();
}
Is there a better way, maybe using reflection ...
I've just started using C#4.0(RC) and come up with this problem:
class Class1 { public Class1() { } }
class Class2 { public Class2(string param1) { } }
class Class3 { public Class3(string param1 = "default") { } }
Type[] types = new Type[] { typeof(Class1), typeof(Class2), typeof(Class3) };
// Problem starts here, main-method
for(int ...
This is probably a simple one but I can't seem to figure it out.
I have a bunch of form items created by the form designer declared as (in frmAquRun.Designer.vb)
Public WithEvents btnAquRunEvent1 As VisibiltyButtonLib.VisibilityButton
Public WithEvents btnAquRunEvent2 As VisibiltyButtonLib.VisibilityButton
... etc
And I basically wa...
I'm looking for the best approach for generating data transfer objects from business objects (the type definition, not mapping the data) using a set of conventions (e.g. all public properties), and possibly configurable to determine how deep to go.
I realize that this may not be possible or even desirable for many cases where the dto's ...
Is there a way to call a method from a class and passing on some parameters with getType() by passing on the objectname of the class?
public void ForeachInsert(object tblnaam, string error)
{
tblnaam.GetType().GetMethod("nameOfMethod");
//where to place string error?
}
...