.net

Invoking a URL - c#

I m trying to invoke a URL in C#, I am just interested in invoking, and dont care about response. When i have the following, does it mean that I m invoking the URL? HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); ...

Override app.config settings embedded into a MSI?

I have a .NET solution with an installer project that generates an MSI. One of the projects installed by the MSI contains an App.Config file. It appears that the values of that config file are embedded into the MSI at compile time. Is there a way to override them at runtime? For instance, the App.Config I'm working with sets the URL of ...

How can I add default values to a parameterized query

When using stored procedures I am able to add default values to parameters, for example: @name varchar(50) = NULL Is is possible to do something similar when using a parameterized query in .NET. Thanks ...

Remove namespace declarations from web service response

I have a web service that returns a simple object: [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.SoapTypeAttribute(Namespace="urn:CHA...

Overwriting dlls in MEF.

Right now, I'm trying to separate out a set of constantly changing classes into their own dll and dynamically load them using MEF. My problem is that whenever I try and overwrite the dll while the app is running, it says it's in use. Is there anyway to configure MEF to let me overwrite the dll and pick up the changes while the app is ...

C# LINQ question, Why need new here?

Why we need the new in the select statement on one of them? var runs = from sampleDataTable in db.SampleData from sampleInfoTable in db.SampleInfo where sampleDataTable.SampleInfo.SampleInfoId == sampleInfoTable.SampleInfoId select new {sampleDataTable.Timestamp, sampleDataTable.SampleDataId, sampleInf...

Looking for a good implementation that will access multiple databases simultaneously

I just want to find out if there's a good implementation (in C#/ASP.NET) on how to access my records from my different databases simultaneously. I have this simple application which suppose to search on these databases, then, display the record if a certain keyword is matched. I have like 5 databases (currently using MySQL) all in all a...

How to improve compare of item in sorted List<MyItem> with item before and after current item?

Does anyone know about a good way to accomplish this task? Currently i'm doing it more ore less this way, but i'm feeling someway unhappy with this code, unable to say what i could immediately improve. So if anyone has a smarter way of doing this job i would be happy to know. private bool Check(List<MyItem> list) { bool result = t...

Accessing a chart's source data cells

What is the best way to access the cells that provide the data to a chart in Excel 2007 (using .Net). ...

Enum.TryParse with Flags attribute

I have written code to TryParse enum either by value or by its name as shown below. How can I extend this code to include parsing enums with Flags attribute? public static bool TryParse<T>(this T enum_type, object value, out T result) where T : struct { return enum_type.TryParse<T>(value,...

Java Applet in Firefox

Hi All, I am facing a weird problem in Testing server while using applet (using embed tag) in my ASP.NET MVC application Applet works fine locally in both browsers IE and Firefox but when deployed to Testing server its throwing below exception for Firefox only (IE works fine). Please help me out in this basic: exception: javax.xml....

TcpListener is queuing connections faster than I can clear them

As I understand it, TcpListener will queue connections once you call Start(). Each time you call AcceptTcpClient (or BeginAcceptTcpClient), it will dequeue one item from the queue. If we load test our TcpListener app by sending 1,000 connections to it at once, the queue builds far faster than we can clear it, leading (eventually) to tim...

Practical example where Tuple can be used in .Net 4.0?

I have seen the Tuple introduced in .Net 4 but I am not able to imagine where can be it be used. We can always make a Custom class or Struct. Edit: I am looking for an example which can also be considered inside the bracket of best practices. ...

Can I create and connect to a SQL Server CE database if SQL Server 2005 isn't installed?

Is there any way to do this? Update: Sorry, I should have included more information. I am trying to create and connect to a SQL CE database using System.Data.SqlServerCe in C# running on a PC (i.e. not running on a Windows Mobile device). This code: string connstr = "Data Source=\"" + filename + "\";Persist Security Info=False;...

Why is a .net generic dictionary so big

I am serializing a generic dictionary in VB.net and I am very surprised that it is about 1.3kb with a single item. Am I doing something wrong, or is there something else I should be doing? I have a large number of dictionaries and it is killing me to send them all across the wire. The code I use for serialization is Dim diction...

Can anyone explain to me why the following code throws System.Reflection.AmbiguousMatchException?

using System; using System.Reflection; namespace A { interface IObjectWithId<TId> { TId Id { get; } } interface IEntityBase : IObjectWithId<object> { new object Id { get; } } abstract class BusinessObject<TId> : IObjectWithId<TId> { public abstract TId Id { get; } } class EntityBase : BusinessObject<objec...

How to export GridView data to pdf file in Asp.net and C#?

Currently I am facing the tedious problem of exporting complete GridView data to the pdf file so that the user can save it. I am using C# as the language in Asp.net 3.5. Kindly guide me. The gridview contains only text values. Thanks in advance. ...

How to fine tune a Membership Provider?

After all the answers to my last question about fine-tuning turned out to be more useful than I expected, I thought that I would ask another similar Question about the MembershipProviders as well. Okay, so firstly, to clarify: I know what a Membership, Role, and Profile provider is, how to implement my own, and how to configure them, an...

C#, cannot understand this error?

I am using VS2008. I have a project, SystemSoftware project, connect with a database and we are using L2E. I have a RuntimeInfo class which contains some shared information there. It looks like this: public class RuntimeInfo { public const int PWD_ExpireDays = 30; private static RuntimeInfo thisObj = new RuntimeInfo...

Retrieve selected elements in GeckoWebBrowser

I am using GeckoFX version 1.9.1.0 with C#.NET. I have a placed a GeckoWebBrowser Component (geckoWebBrowser1) and a Button (button1) in a form and have navigated the browser to a page. Some text in the page can be selected. This text is composed of one or more DOM elements. When button1 is clicked, I want to retrieve the DOM elements th...