Using reflection I'd like to retrieve only the built-in data type properties from a C# object. Is there a better way to do that then using a bunch of || (ors) in a Where method specifying the types I am interested in?
Type sourceType = typeof(TSource);
var props = sourceType.GetProperties()
.Where(pi => pi.PropertyType == typeof(in...
Working with iPhone and Objective C.
I am working on a game and I need to correctly reflect a ball off a circle object. I am trying to do it as a line and circle intersection. I have my ball position outside the circle and I have the new ball position that would be inside the circle at the next draw update. I know the intersect point of...
I am looking for the simplest way to do a deep copy of a flat Map<String, String> of nested properties to a bean. Some of the nested properties are interfaces for which I would like to provide a strategy for instantiation. For example:
Map<String, String> customer = new Map<String, String>();
customers.put("id", "123");
customers.put(...
Hi,
I have a very simple setup, single mycontrol.ascx with assoicated mycontrol.ascx.designer.vb and mycontrol.ascx.vb file.
mycontrol.ascx embeds a single reference to a custom control: "MyMenu":
<mM:myMenu id="myMenu1" runat="server" />
This has created a protected reference in the mycontrol.ascx.designer.vb file:
Protected ...
I have a unit test (nUnit). Many layers down the call stack a method will fail if it is running via a unit test.
Ideally you would use something like mocking to setup the object that this method is depending on but this is 3rd party code and I can't do that without a lot of work.
I don't want setup nUnit specific methods - there are to...
Hi All,
when load dll file using .net reflection(the loaded file description is : Microsoft C Runtime Library), I got Run time error (R6034)
when load dll that not using C runtime library it will be loaded successfully,
can I load dll that using C runtime using .net reflection, if not, then how to catch this exception ?
Find my code belo...
I am trying to create a library which depends heavily on annotating class properties. The properties should be able to be annotated via getters or on the actual underlying fields (ala JPA etc.)
Is there some standard for this? Tons of libraries do this (e.g. Hibernate). Do they all just roll their own implementation and conventions? Is ...
I want to distinctly determine if the type that I have is of custom class type (MyClass) or one provided by the Framework (System.String).
Is there any way in reflection that I can distinguish my class type from system.string or other Framework provided types?
...
Scenario: I have a class that extends another class, yet the parent class is undefined (for whatever reason). I am trying to get a ReflectionClass of the child class. When I do this, I get a Class Not Found exception on the parent class. However, I cannot catch this exception. What am I doing wrong?
For example...
<?php
class Foo ...
I have a UserControl which contains a TextBox and a CustomValidator.
I would like to set the CustomValidator.ServerValidate to a method in the page that contains the UserControl
I found this code which will allow me to dynamically set the custom validators validation function:
cusvCustom.ServerValidate += new System.Web.UI.WebControls...
I currently have a C# project which uses plugins and has a fairly common approach to plugin handling: an IPlugin interface is stored in a dll which is linked in a tranditional dynamic way. The host app looks for class libraries exporting classes exposing this interface and loads them via reflection at run time.
The dll containing the in...
I've got a piece of code in a project (MyProject) that contains early bound object from a referenced assembly (We'll call it CommonAssembly):
Dim myObject As CommonAssembly.MyEarlyBoundType
now I have another assembly that is dynamically loaded because it is not present in all projects:
Dim myLateBoundObject As Object = AppDomain.Cu...
Hello Masters!
I´m writting a page that need to call an User Control Method dinamically.
I have a GridView on my page and on the RowDataBound I´m loading this User Control for each row.
At my User Control I have a public void Method that I need to call when I load this Control.
I was reading about reflection, but at the code that I ...
In my precent questions, I want to retrieve some values via reflection.
Now I want set values to objects thanks to reflection.
I want to write this :
private void AppliquerColonnesPersonnalisation(Control control, Propriete propriete, PropertyInfo Info)
{
UltraGrid grille = (UltraGrid)control;
SortedList...
how can be a collection of global and/or local varibles be obtained in javascript?
(like e.g. in Python by globals() or locals())
if there is no such functionality available in javascript, how do some javascript console interfaces obtain them, to be able to autocomplete?
...
I am updating our CruiseControl.NET continuous integration environment from using the old Visual Studio 2008 Web Deployment projects to Visual Studio 2010.
I do not want to use the Beta 2010 Web Deployment projects as I think I can make use of the updated Publishing/Packaging in 2010.
Currently I have managed to configure the CruiseCo...
I've been working on creating my own IoC container for learning purposes. After asking a couple questions about them, I was shown that creating a factory to "resolve" the objects was the best solution (see third solution here). User Krzysztof Koźmic showed that Castle Windsor actually can implement this for you.
I've been reading the so...
I've read that assembly serialization (sgen.exe) can improve performance.
What exactly is providing the improvement?
Is it metadata on the Types? I would have thought this would be available through reflection! so why is it required in a separate assembly?
...
Hi
I'm making a windows application where user selects a type from combo box. Based on the selection, using reflection I want to create instance of the respective type and invoke one of its method.
The Types I want to create are also defined in the same windows app as sperate classes. But i'm getting the error as mentioned in Title. He...
First here is the scenario.
I'm targeting 3.5 SP1 and I'm using CommentChecker to validate my XML documentation, everything works OK until I get to a class like this:
/// <summary>
/// documentation
/// </summary>
public sealed class MyClass {
/// <summary>
/// documentation
/// </summary>
public void Method() {
}
}...