I am currently in a programming mentality that Reflection is my best friend. I use it a lot for dynamic loading of content that allows "loose implementation" rather than strict interfaces, as well as a lot of custom attributes.
The question I have is, what is the "real" cost to using reflection?
Is it worth the effort for frequently ...
I have an array of shorts (short[]) that I need to write out to a file. What's the quickest way to do this?
...
I want to change the order of XML using XDocument
<root>
<one>1</one>
<two>2</two>
</root>
I want to change the order so that 2 appears before 1. Is this capability baked in or do I have to do it myself. For example, remove then AddBeforeSelf()?
Thanks
...
As documented by the MSDN here, there are several providers for many of the different hashing algorithms (e.g. MD5, SHA, RIPE). For each of the algorithms, any available implementation seems to fall into 1 of 3 categories:
[Algo]Cng
[Algo]CryptoServiceProvider
[Algo]Managed
Why are there multiple implementations of any of these hashi...
What is the best way to delete a database record using LINQ when I have the primary key?
...
I want to use typed parameters in the web methods. But when visual studio 2005 creates the web reference on for the client it automatically creates it's own types. I am using a .net web service and a .net client.
For example:
< WebMethod > _
Public Function Foo() as ServerNamespace.Bar
...
End Function
at the client the method beco...
I'm working on a WPF application and is using the Model-View-ViewModel pattern.
The application consists of two modules at the moment:
Left Panel to browse a tree and select a node
Main Panel to show the content of the selected tree node.
I want to keep these two modules seperated, but when I select a node in the Left Panel I need t...
i want to get datetime for 2days before. i.e) how to subtract 2 days from datetime.now
...
What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some transactions while inserting data into the DB. Any responses or links for even basic stuff about ...
I'm wondering if it's possible to embed Ruby as a scripting language in Microsoft XNA, and what's the best way to do that. I'm looking for something like Xnua, except for Ruby.
I've stumbled upon Ruby.NET and IronRuby and both seem to be in very early stages, so I'm not sure how usable they are. Furthermore, I'm not sure if they'd work...
I'm working on a project where we mix .NET code and native C++ code via a C++/CLI layer. In this solution I want to use Thread Local Storage via the __declspec(thread) declaration:
__declspec(thread) int lastId = 0;
However, at the first access of the variable, I get a NullReferenceException.
To be more precise, the declaration is don...
I would like to move items from one list to another on a page, and I'm pretty flexible about what type of a list it is. What's the best way to do that? ASP.NET Ajax? jQuery? Anything else?
...
I am using a native library which returns an IntPtr to a memory location, which contains the value of an attribute. I know what the type of the attribute is and I have a method for marshalling a value (taking the IntPtr and the type of the attribute) from the memory pointed at by the pointer. This method either calls Marshal.ReadInt32,...
Is this possible? I am looking forward to a tutorial which explains the steps to achieve this.
...
I'm tryint to post to a ADO.NET Data Service but the parameters seems to get lost along the way.
I got something like:
[WebInvoke(Method="POST")]
public int MyMethod(int foo, string bar) {...}
and I make an ajax-call using prototype.js as:
var args = {foo: 4, bar: "'test'"};
new Ajax.Requst(baseurl + 'MyMethod',
method: 'POST',
...
I recently upgraded a c# windows service to run as a 64 bit .net process. Normally, this would be trivial, but the system makes use of a 32-bit DLL written in C++. It is not an option to convert this DLL to 64 bit, so I wrapped the DLL in a separate 32 bit .net process and exposed a .net interface via remoting.
This is quite a reliable ...
No I'm not being a wise guy ...
For those fortunate enough to not know the My class: It's something that was added in VB 2005 (and doesn't exist in C#) and is best described as a 'speeddial for the .net framework'.
Supposed to make life easier for newbies who won't read which framework classes they should be using
Dim contents As Stri...
I installed a windows service using installUtil.exe.
After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first.
When I now try to uninstall the service, installUtil.exe completes the uninstall successfully, but the service still appears.
If I try to change its properties,...
Hi,
I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of managed classes, so COM isn't my shortest/easiest route.
Thanks!
...
In C#, I am using a library that defines an enum. I would like to allow consumers of my code (in a different assembly) to pass in an enum value as a parameter to one of my functions without having to reference the underlying library themselves.
Is there a way for me to expose the library's enumeration to my consumers?
...