.net

IMetaDataExchange could not be found in the list of contracts implemented by the service

I have searched the web for resolution of this error, but everything I have found suggests what I have is correct. Maybe someone could take a look and spot an obvious mistake I just cannot see. I have a windows service, hosting two contracts: IConfigurationService IConfigurationAdminService The admin service inherits from the stand...

C# reflection getting nullable type

i have class, with fields of double? type. with reflection i get fields Parameters cl = new Parameters(); FieldInfo[] fi = cl.GetType().GetFields((BindingFlags.NonPublic | BindingFlags.Instance)); now, i want get fields, only with double? type, gow can i get this type, to compare with fields from fi? smth like: if(fi[0].FieldType ==...

Adding a Http-Header in a HttpModule and read it out from a Page

I've tried to write my own HttpModule (IHttpModule) that adds a Header like that: public class MyModule: IHttpModule { public void Init(HttpApplication c) { c.BeginRequest += delegate{c.Response.AddHeader("MyHeader", "MyValue");}; } public void Dispose(){} } and tried to read in a aspx page like that: var x ...

How to print line numbers for textbox in c#

This is going to be a long post. I would like to have suggestions if any on the procedure I am following. I want the best method to print line numbers next to each CRLF-terminated-line in a richtextbox. I am using C# with .NET. I have tried using ListView but it is inefficient when number of lines grow. I have been successful in using Gr...

insert XmlDocument into a XmlDocument node

I created a basic XmlDocument with one node: XmlDocument bigDoc = new XmlDocument(); bigDoc.LoadXml("<Request></Request>"); and I'm getting another XmlDocument that I want to insert inside <Request> node. It doesn't work for me: XmlNode requestNode = bigDoc.FirstChild; requestNode.AppendChild(anotherXMLDocument); It thorows an e...

I can't use the task scheduling, alternatives?

Hi, I've been definitely told by my IT office that as my SQLServer database is in a shared SQL Server they can't run any executables via the server scheduling task service . The executable would query my database on a daily basis, update data in it and send an email. First, is this true? And secondly, do I have an alternative using .net...

Retrieve Printer's Duplex setting when using PPD Driver

I have a Windows printer configured using a PPD based driver (see Wikipedia). The PPD file defines Duplex as being supported and the duplex setting can be changed via the Printer's Printing Preferences (right click on the printer and choose properties). I have confirmed the setting works by printing a two page document. The problem I h...

Getting Data from PAC file

Is it possible to execute the Javascript in a PAC file from a .Net windows application to return the proxy server? ...

How can do an invariant .Contains(myQuery) with Linq to Objects?

Hi folks, I'm trying to filter a list of objects using linq. When i filter by a Contains(someSearchQuery) it's like it's being case sensitive .. meaning i miss some results. I have an IList<Foo>'s which has a number of properties, but one is public string MyText { get; set; } Now, i'm trying to return a IQueryable of Foo's where the...

.net html to image with managed code.

I have service which converts HTML to image and sends back. At present I am using WebBrowser control to do that. But it is far from perfect. During peak hours service crashes or gives Null reference exception. Also it is not lightweight on memory. I looking for lightweight managed option to this job. Kindly let me know for any open ...

Is there a way to use linq in C# application with .net framework 2?

I need to use linq in C# Windows form application working with .Net Framework 2 not 3.5 . I Know it may be some sort of stupidity to do that. but i need that for some special reasons. Can i import just linq libraries to my project by anyway ? or there is no way except for using 3.5 ? ...

Can I load type from Silverlight 4 class lib assembly into my .NET 3.5 based process?

By now when I attempt to var a = Assembly.LoadFrom("SL4ClassLib.dll"); var typeInstance = a.CreateInstance("ClassName"); I get FileNotFoundException, because no System.Runtime.Serialization Version=2.0.5.0 found. This assembly goes with SL 4 runtime. I can't add reference to it from my 3.5 app, cause it already has reference to Syste...

Using Console.Out.WriteLine vs Trace.WriteLine in nUnit either running in isolation or within reSharper or TeamCity

I vaguely remember reading "something" "somewhere" about using Trace.WriteLine over Console.Out.WriteLine in nUnit possibly in the context of reSharper or TeamCity but I cannot remember the details. Therefore the question is either in the context of nUnit running separately or within reSharper/TeamCity is there any benefit of using one ...

Use LINQ to read all nodes from XML

I have a XML file, like this: <?xml version="1.0" encoding="utf-8" ?> <ROOT> <NAME> ItemName </NAME> <LIST> <ITEM> ListItem1 </ITEM> <ITEM> ListItem2 </ITEM> <ITEM> ListItem3 </ITEM> </LIST> </ROOT> How can I use LINQ to get all the ITEM...

.NET Signed assembly - how to protect against someone removing the signature

There is a general perception about signing an assembly protects against hacking/modifying the code. But then there are well known way of ILDASMing to remove these signatures. I am wondering if there are anyways to protect my .net assembly against someone removing the signature? Does seem like obfuscating my code can be anyhelpful in thi...

NoSQL WideTable system which supports Column Value based Queries?

I'm currently evaluating possible NoSQL WideTable systems for use as a storage backend for an experimental project I'm working on but I'm struggling with the fact that many of these seem to have vague/incomplete documentation and it's hard to determine whether a specific feature is supported. Specifically I need to be able to do queries...

How to encode CR LF in DataSet.WriteXML?

I am using DataSet.ReadXML and DataSet.WriteXML to read and update an XML file. In some places I have a text column that may contain carriage return, linefeed (&#13;&#10;) When I put &#13;&#10; in the input file, ReadXML works fine and I get \r\l in the column's value. However when I update with DataSet.WriteXML, the output file appea...

How to programmatically detect 32-bit or 64-bit visio version is installed?

How to programmatically detect 32-bit or 64-bit visio version is installed? ...

How do we do idle time processing in WPF application?

Is there a way to do idle time processing in WPF application equivalent to OnIdle event in MFC? ...

Transactional And Reporting Databases - How?

When building a transactional system that has a highly normalized DB, running reporting style queries, or even queries to display data on a UI can involve several joins, which in a data heavy scenario can and usually does, impact performance. Joins are expensive. Often, the guidance espoused is that you should never run these queries of...