I'd like to implement an interface that resides in an external assembly. However that particular interface has been marked as "internal". Is there a way I can still implement this interface for my own classes?
I know how to call private/internal methods using reflection in C#, so I guess reflection should be used in this case too. Howev...
Is there a way to find out if the calling function had attributes set on it?
[RunOnPlatformB]
int blah()
{
return boo();
}
int boo()
{
// can i find out if RunOnPlatformB was set on my caller?
}
...
I wanna to compare two objects, for example:
DirectoryInfo di1 = new DirectoryInfo("C:\\");
DirectoryInfo di2 = new DirectoryInfo("C:\\");
OK, yeah I know we have here different reference, this class doesn't implement IComparable, and even GetHashCode is returning the different results.
But they are the same! (logically:))
I know ...
I have existing code for an ASP .NET application that uses reflection to load dataproviders. I would like to re-use this code in a WPF application but it appears that BuildManager.GetType only looks through top level assemblies if the app isn't ASP .NET. Does anyone know how to get around this limitation?
The following code throws an ex...
Anyone know how to get a Type object from a FullName?
Eg.
string fullName = typeof(string).FullName;
Type stringType = <INSERT CODE HERE>
Assert.AreEqual(stringType, typeof(string)
...
Once a class is loaded is there a way to invoke static initializers again?
public class Foo {
static {
System.out.println("bar");
}
}
Edit:
I need to invoke the static initializer because I didn't write the original class and the logic I need to invoke is implemented in the static initializer.
...
I'm writing .NET On-the-Fly compiler for CLR scripting and want to implement next idea: there is a template file with C# code, I want to read it, create an assembly, load it and amplify source on-the-fly. How can I do that?
...
details: I'm trying to use Jalapeno framework to connect my RCP app with Cache' database. After connection established, I'm trying to get all data from table exactly like in Jalapeno manual:
if (objManager==null) return;
DBClass cortege = null;
try {
Iterator terms = objManager.openByQuery(DBClass.class, null, null);
System.out.println(...
I am an absolute novice at reflection in C#. I want to use reflection to access all of private fields in a class, including those which are inherited.
I have succeeded in accessing all private fields excluding those which are inherited, as well as all of the public and protected inherited fields. However, I have not been able to acc...
I'm currently working on a web project that involves several assemblies, structured something like this:
WebProject
|
+--> A (external assembly, Version 1.0.0.0)
|
+--> B (external assembly, Version 1.0.0.0)
The difficulty is that in order to keep track of what's deployed, I'd like to updated the version numbers of assemblies A an...
Hello ...
I have a Generic class like that :
public class Repository<T> {...}
And I need to instance that with a string ...
Example :
string _sample = "TypeRepository";
var _rep = new Repository<sample>();
How can I do that? Is that even possible?
Thanks!
...
Hello, everyone!
I've run into the problem with NHibernate proxy validation using Castle.Validator component. It's looks like validator could not fetch attributes from entity proxy's properties.
I've tried to define validation attributes using Inherited = true while Castle.Validator runner fetch em using following statement:
property....
I need to be able to get from .NET assembly a class/struct/interface definition location (filename,begin_line,begin_column,end_line,end_column) in my source files.
First solution that came to my mind was using some pdb quering api, but it seems that I can obtain such info only for method definition this way. Or maybe I'm wrong...
To pr...
Presuming I have the strings "List" and "Socket," how would I go about creating a List<Socket>?
The answer I need will work just as well for Queue and XmlNodeList, not to mention MyCustomGeneric with MyCustomClass.
...
I am getting started with the notion of test-driven development, and kind of failing since I am finding that I know what the test is going to be kind of, but I can't figure out how to get it to do what I want. What I have is a property that has a public getter and an internal setter. I'd like to test the functionality by accessing the ...
Is there any tools to check for dead code for PHP5? Something like
Scan classes with Reflection
Follow "normal" code with token_get_all() and find variables with token T_NEW and then scan for method calls.
Output something like classname (count of new declarations) methods (count of calls)
...
I am trying to select the ChartArea using the Select method through reflection in C#. This is the line of code I am using:
oChartArea.GetType().InvokeMember("Select", BindingFlags.InvokeMethod, null, oChartArea, null);
Here, oChartArea is the ChartArea object.
This works perfectly fine in Vista/Office 2007 but throws exception in XP...
If a variable refers to either a function or a class method, how can I find out which one it is and get the class type in case it is a class method especially when the class is still being declared as in the given example.
eg.
def get_info(function_or_method) :
print function_or_method
class Foo(object):
def _...
I am using the following the following class org.apache.poi.hssf.usermodel.HSSFCell, with a list of the following methods:
void setCellValue(boolean value)
void setCellValue(java.util.Calendar value)
void setCellValue(java.util.Date value)
void setCellValue(double value)
void setCellValue(HSSFRichTextString value)
void setCellValue...
Under a given namespace, I have a set of classes which implement an interface. Let's call it ISomething. I have another class (let's call it CClass) which knows about ISomething but doesn't know about the classes which implement that interface.
I would like that CClass to look for all the implementation of ISomething, intanciate an inst...