|
|
Stories recently tagged with 'Reflection'
|
|
submitted by
rprouse
10 days ago
alteridem.net — One thing that I find tiresome when using the various Model/View patterns is the constant copying of data between the model and the view. This is the first post in a series on a possible easier way to do this. In this post I write a method that copies the data from one interface to another based on the names and types of the properties. Over the next few posts, I will extend the code to use generics and extension methods. read more...
add a comment
|
category: C# | Views: 13
|
|
tags:
MVP, Tips, Reflection, C#, .Net | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
submitted by
crpietschmann
1 month, 26 days ago
blogs.msdn.com — Previously, I mentioned some things in Metadata that aren't exposed in Reflection. Here's an opposite case. While metadata represents static bits on disk, Reflection operates in a live process with access to the CLR's loader. So reflection can represent things the CLR loader and type system may do that aren't captured in the metadata. read more...
add a comment
|
category: CLR | Views: 3
|
|
tags:
array, Reflection, CLR | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
published 3 months, 1 day ago, submitted by
yoavsion
3 months, 3 days ago
sharpregion.com — Sometimes we need to find all classes or interfaces that derive a certain Type. There are several possible scenarios for this kind of search - For instance, if we are trying to load a plug-in assembly at runtime and wish to initialize all the classes that implement the IPluginBase interface. Using the suggested DerivedHelper makes it a lot easier. read more...
add a comment
|
category: C# | Views: 3
|
|
tags:
Utility, sharpregion, Reflection, C#, ExtensionMethods | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
submitted by
crpietschmann
4 months, 20 days ago
pietschsoft.com — I was thinking about how JavaScript JSON serializers go about serializing objects. But how does the serializer know about each of the objects properties? I figured JavaScript must have some method of object reflection (similar to .NET Reflection) and it does. Here's a simple Reflection namespace that allows you to more easily reflect through an objects methods and properties: read more...
add a comment
|
category: AJAX | Views: 1
|
|
tags:
Reflection, JavaScript, AJAX | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
submitted by
animaonline
5 months, 5 days ago
softscenario.blogspot.com — Some weeks ago I was working on a project where we receive some ten or twenty different message types from a server, and they all need to be handled when they arrive. Of course, we want to use event driven programming to make this happen on the fly, instead of polling all the time.
All of the messages have the header in common, so we already made a abstract parent class called Message, and when it came to handling all the different messages, we wanted to write as little code as possible. So we added an abstract method called HandleResponse to the code.
So the idea was to identify the incoming message type and invoke the HandleResponse using reflection on the object that we had identified this as. To do this, we made a little xml file that contains the message code (A-Z) along with the name and reference to the class linked to the message type. When the program starts, it reads the xml into a dictionary, so we can look up the key (message code) and get the class reference in return.
XDocument descriptorsXml = XDocument.Load( @".\Data\MessageDescriptors.xml");
var descQuery = from desc in descriptorsXml.Descendants("Message")
select new MessageDescriptor
{
Code = desc.Element("Code").Value,
Name = desc.Element("Name").Value,
ObjectType = desc.Element("ObjectType").Value.ToType() ,
IsServerMessage = Convert.ToBoolean( desc.Element("IsServerMessage").Value )
};
foreach (MessageDescriptor m in descQuery)
{
descriptors.Add(m.Code, m);
}
Then, we have a MessageHandlingFactory that simply gets objects in from a queue, identifies the type, and invokes the HandleResponse. If the object isn't recognized (could be a new message type, or could be that the programmer forgot to insert the description in the XML file), the MessageHandlingFactory can either throw an exception, or better yet, return a string with message that tells the user what went wrong. If everything goes as planned, it returns a string with the identified typename.
object theType = Activator.CreateInstance(t, SessionID);
EventInfo eInfo = t.GetEvent("OnWriteEvent");
Message.WriteEventHandler theHandler = new Message.WriteEventHandler(OnWriteEventHandler);
eInfo.AddEventHandler(theType, theHandler);
theType.GetType().GetMethod("HandleResponse").Invoke(theType, new object[] { message });
return "MessageHandler: " + messageType;
That's all, folks!
Update February 13, 2008: The code has now been tested in a very high throughput environment, and it performs read more...
add a comment
|
category: C# | Views: 1
|
|
tags:
software, Scenario, .Net, C#, Reflection | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
published 11 months, 12 days ago, submitted by
activa
11 months, 13 days ago
blog.activa.be — The web framework I built over the last few years, ProMesh.NET, relies on reflection for a lot of the features it offers. Often though, I am asked if the heave use of reflection doesn’t have a significant impact on performance.
My answer usually is: YES, but it doesn’t matter. Now you probably think that I don’t care about performance or that I’ve had too much too drink. None of the above. I’ll explain: read more...
add a comment
|
category: CLR | Views: 0
|
|
tags:
Performance, Reflection | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
published 1 year, 1 month ago, submitted by
spirit1
1 year, 1 month ago
weblogs.sqlteam.com — Arity is the number of arguments that a method takes.
If you ever used reflection and CodeDOM, this is a good thing to know of.
read more...
1 comment
|
category: C# | Views: 0
|
|
tags:
CodeDom, Arity, C#, Reflection | tag it
Everyones tags: | Your tags: | |
|
|
|
|
|
published 1 year, 2 months ago, submitted by
jiltedcitizen
1 year, 2 months ago
codeproject.com — This article is about using reflection. For those of you that don't know what reflection is, it is the ability to obtain information about a Type of object without really knowing anything about the object type that is being dealt with. For example one could simply ask the current Type of object if it supports a certain method name, if it does, the method can be called. This may sound strange but it is a very powerful technique. Lets suppose that I simply want to look at what methods a class supports, well that is also easily achieved using reflection. .NET allows developers to leverage reflection in many ways. read more...
add a comment
|
category: CLR | Views: 0
|
|
tags:
CodeProject, Reflection | tag it
Everyones tags: | Your tags: | |
|
|
|
|

Sponsored Link: www.carlist.ie
Ads via The Lounge
|