Given a generic type, including
List<string>
Nullable<Int32>
how do i get a generic name for C#?
var t = typeof(Nullable<DateTime>);
var s = t.GetGenericTypeDefinition().Name + "<" + t.GetGenericArguments()[0].Name + ">";
This yields
"Nullable`1<DateTime>"
, but i need
"Nullable<DateTime>"
.
...
I need to mimic changes (property/list) changes on an object and then apply it to another object to keep the structure/property the same.
In essence it's like cloning etc. the biz rules require certain properties to not be applied to the other object, so I can't just clone the object otherwise this would be easy.
I've already walked th...
Is it possible to get the parameter names of a method ?
Example with:
def method_called(arg1, arg2)
puts my_method.inspect
end
I would like to know what method (my_method) should I call to get the following output:
["arg1", "arg2"]
...
Currently I am doing the profiling to a piece of code. During the profiling, I discovered that this very method call,
Class<T>.isAssignableFrom(Class<?> cls)
takes up to quite amount of the entire time.
Because this is a method from reflection, it takes a lot of time compared to normal keywords or method calls. I am wondering if the...
I want to list properties and functions present in c++ classes. Is that functionality already implemented in any library ? Does visual studio intellisense use any library ? Is that library available publicly from Microsoft?
...
hi,
I wanted to make an application that will take either the path of the dll or Webservice and list me all the functions present in that dll. I accomplished the listing of the function using this but I am not able to list the functions of the Webservices. Using Assembly.GetMembers() it's listing the Function Name with the Parame...
Problem
One friend suggested an interesting problem. Given the following code:
public class OuterClass {
private String message = "Hello World";
private class InnerClass {
private String getMessage() {
return message;
}
}
}
From an external class, how may I print the message variable content...
I'm doing a bit of Powershell scripting ( for the first time ) to look at some stuff in a Sharepoint site and what I would like to be able to do is to go through a list of properties of an object and just output their values in a "property-name = value" kind of format.
Now I can find the list of elements using this:
$myObject | get-mem...
Hello, I am using the java version of the google app engine.
I would like to create a function that can receive as parameters many types of objects. I would like to print out the members of the object. Each objects may be different and the function must work for all objects. Do I have to use reflection - if so, what kind of code do I ne...
I would like to add custom attributes to a MySQL table which I can read via php.
These attributes are not to interfere with the table itself - they are primarily accessed by php code during code generation time and these attributes HAVE to reside in the DB itself.
Something similar in concept to .NET reflection.
Does MySQL support any...
hi,
in my project i want to invoke the main method which is static . I got the object of type Class but i am not able to create an instance of that class and also not able to invoke the static method "main".Help
...
hi,
i load a class using ClassLoader but i am not able to create an object of that class.Here is the code.What is the problem?Help
Cloader = new URLClassLoader(new URL[] {new File(binfolderurl).toURI().toURL()},ClassLoader.getSystemClassLoader);
Thread.currentThread().setContextClassLoader(Cloader);
Class clss = Cloader.loadClass("...
MyClass.class and MyClass.getClass() both seem to return a java.lang.Class. Is there a subtle distinction or can they be used interchangeably? Also, is MyClass.class a public property of the superclass Class class? (I know this exists but can't seem to find any mention of it in the javadocs)
...
I am pretty new to WCF applications. I have a WCF application that is using NetTcpBinding. I wanted to invoke the functions in WCF service using the System.Reflection's Methodbase Invoke method. I mean I wanted to Dynamically call the Function by passing the String as the Function name. Reflection works great for Web Service or a Windows...
Hi,
Is it possible to obtain a list of functions declared in an unmanaged DLL? I want to create this list in a c# program.
Using dumpbin or System.Reflection.Assembly is not possible.
Thanks
...
I've noticed that reflection is one feature that developers from other languages find very lacking in c++. For certain applications I can really see why! It is so much easier to write things like an IDE's auto-complete if you had reflection. And certainly serialization APIs would be a world easier if we had it.
On the other side, one of...
We have a schema that we serialize and deserialize into an object hierarchy.
Some elements are optional in the schema. The xsd tool creates a cs file that inserts a property for each optional element. This property ends in "Specified", i.e. nameSpecified tells the serializer and deserializer to include the optional "name" element when pr...
Specifically, I'm trying to create a unit test for a method which requires uses File.separatorChar to build paths on windows and unix. The code must run on both platforms, and yet I get errors with JUnit when I attempt to change this static final field.
Anyone have any idea what's going on?
Field field = java.io.File.class.getDeclaredF...
I have code which looks like:
private static DirectiveNode CreateInstance(Type nodeType, DirectiveInfo info) {
var ctor = nodeType.GetConstructor(new[] { typeof(DirectiveInfo) });
if(ctor == null) {
throw new MissingMethodException(nodeType.FullName, "ctor");
}
var node = ctor.Invoke(new[] { info }) as Directiv...
In actionscript an object's property can be accesses in this way:
object["propertyname"]
Is something like this possible in c#, without using reflection?
...