.net

Smart HTML encoding

I'm looking for the best way to do some sort of "smart" HTML encoding. For instance: From: <a>Next >></a> to: <a>Next gt;gt;</a> From: <p><a><b><< Prev</b></a><br/><a>Next >></a></p> to: <p><a><b>&lt;&lt; Prev</b></a><br/><a>Next gt;gt;</a></p> So only the non XML / HTML part of the text would be encoded as if HtmlEncode is called. A...

Binding a Datatable to a Datagridview

Do you have any suggestions for my code below that you might have to improve the performance? This is .NET 2.0 framework, and the DataTable gets bound to a DataGridview. The data is loaded into the Datatable via .ReadXML() it doesn't come from a database. There can be any where from 80 to 100k of records. The Terms() array is what th...

problem with .Net xml importnode

Hi, Im trying to construct a powershell script that uses some XML. I have a XML document where I try to add some values with email addresses. The finished xml document should have this format: (I'm only showing the relevant part of the xml here) <emailAddresses> <value>[email protected]</value> <value>[email protected]</value> <va...

Removing Wrapper Elements from XML-Serialized Array

I am using VSTS2008 + C# + .Net 3.0. I am using below code to serialize XML, and my object contains array type property, but there some additional elements' layer (in my sample, MyInnerObject and MyObject) generated which I want to remove from the generated XML file. Any ideas? Current generated XML file, <?xml version="1.0"?> <MyClass...

Application/GUI Framework Recommendations

I'm a .net developer looking for an application/GUI framework. I've really only found 1 example of what I am looking for which was provided in a DevExpress KB aricle. Does anybody have any opinions on this example or can recommend something that resembles this that might be better to use. I like the Outlook look and feel so the exampl...

Determine how assembly were invoked

Hello, I'm writing a .NET component to be used both by other .net clients and by legacy applications via COM interop. During recearch I faced expected problem: there is no configuration in case assembly was invoked via interop. So now I need to design a workaround for cases my component was invoked via COM (using some default configura...

Wrapping Serialized Array Elements with the Name of the Array

Hello everyone, I am using VSTS2008 + C# + .Net 3.0. I am using below code to serialize XML, and my object contains array type property, and I want to add an additional elements' layer ("MyInnerObjectProperties" element layer in my expected results below, and I want to make "MyInnerObjectProperties" element as parent element for all My...

Fast PDF Compression Library for .NET

I need a fast PDF Compression library for .NET that will allow me to run 10 concurrent threads each compressing a separate PDF file to around 10% of its original size. Any suggestions? (I have already tried out the product from neeviaPDF.com. It is not as fast as I need.) ...

WCF Message Inspectors

I an developing a WCF service where I need to intercept incoming messages for custom validations. After my research, I found that I need to implement IDispatchMessageInspector for this purpose. So, I inserted my custom validations inside AfterReceiveRequest method of the interface. The problem: When I debug the code, I saw that message ...

If I need pagination support, should I use a ListView or a Repeater ?

If I need pagination support, should I use a ListView or a Repeater ? I can use a DataPager control with a ListView, but not with a Repeater. So what would be the best option ? and why ? ...

Placing a Property into a Different XML Namespace with XML Serialization

I am using VSTS2008 + C# + .Net 3.0. I am using below code to serialize XML, here is my current code and serialized XML file. My purpose is I want to make MyInnerObjectProperties belongs to a special XML namespace (http://foo/2009) and making this namespace as default namespace. Any ideas how to implement this? Current output: <?xml ve...

Calling a .Net Window-based application using Runtime.getRuntime().exec from a Spring Controller running on Tomcat.

I am calling an exe file called myapp.exe via a Spring Controller; here is the code in the controller: Runtime.getRuntime().exec("D:\vmd\apps\myapp.exe"); myapp.exe is a C# .NET application. If I click directly on myapp.exe using Windows Explorer, the application opens up and runs; however, if I call the command through a Spring Control...

Do I have to do validation on a property of type Nullable<int>?

I'm creating a custom configuration section (inheriting System.Configuration.ConfigurationSection), and I'm wondering if I have to do value validation for a ConfigurationProperty that is a Nullable int. I.e., do I have to do this: [ConfigurationProperty("NullableInt", IsRequired = true)] public int? NullableInt { get { ...

C# and SQL Batch Update

Is there any API available similar to JDBC batch update [PreparedStatement.addBatch() and PreparedStatement.executeBatch() ]? I have seen the DataAdapter. However I think it is using DataTable; is it similar to JDBC PreparedStatement? ...

Linq int to string

Hi, how do I cast and int into a string? None of the following do works: from s in ctx.Services where s.Code.ToString().StartsWith("1") select s from s in ctx.Services where Convert.ToString(s.Code).StartsWith("1") select s from s in ctx.Services where ((string)s.Code).ToString().StartsWith("1") select s EDI...

X509 guide/tutorial in C#

Can anyone point me to a good introductory materials on X509 certificates with examples in C#. ...

When would I choose AesCryptoServiceProvider over AesManaged or RijndaelManaged?

I think the distinguishing factors are AesCryptoServiceProvider is FIPS compliant AesManaged is cross-platform, requires .NET 3.0 RijndaelManaged runs on .NET 2.0, requires restricting the blocksize is that about right? ...

Winforms ListView Selection Drawing?

Is it possible to override the listview detault selection paint? The one that looks semi-transparent blue overlayed over the items, like in the explorer windows. I want to draw an outline around the selection to indicate selection. Any way to do this? Examples are appreciated. ...

C# - Loading .NET Assembly into Seperate AppDomain So You Can Unload It

What is the proper way to load a .NET assembly into a seperate AppDomain so you can have access to its Types/Classes but still be able to unload it (and reload it). This is a tangent of this previous discussion: http://stackoverflow.com/questions/1137781/c-correct-way-to-load-assembly-find-class-and-call-run-method ...

UnauthorizedAccessException when using Directory.GetFiles

In the application I am writing, the user has the ability to add some folder to search for some files recursively. The problem is the files he wants to add to the app might be stored in the base drive like K:. So if he add this drive directly, I get an exception. Or if he adds C:\, then I get UnauthorizedAccessException where it says: ...