.net

ServiceContract class for an ASP.NET web service

I want to invoke a web service in my C# client application. I want to be able to bind to this web service dynamically. I am using the following code for dynamically calling a web service: class Program { interface IInterface static void Main(string[] args) { BasicHttpBinding bin = new BasicHttpBinding(); E...

Memory Allocation Question?

public static void Main() { Test t1 = new Test(); } when will t1 (reference variable) will get memory, at compile time or run time. I think it should be run time. But when I put a breakpoint at Main Method and Put a Watch for t1, it was null. So it means t1 was in memory. Please correct me If I am wrong. Edit: I h...

SqlDataAdapter.Fill - Asynchronous approach

Using C# / .NET 3.5. Currently I'm populating 2 DataTables one after the other using SqlDataAdapter.Fill(). I want to populate both of these DataTables in parallel, at the same time by doing each one asynchronously. However, there is no asynchronous version of the Fill() method - i.e. BeginFill() would be great! One approach I've trie...

What is the lowest interception point in the WCF runtime stack?

Dear ladies and sirs. I wish to debug why my application sends so much data using WCF underneath. I tried to examine WCF trace logs and examine the traffic with Fiddler, but I need a stack trace leading to the offending client code. So, I installed a custom IClientMessageInspector, but how can I know the size of the actual data given a...

Compiler-Implemented Immutability in .Net

Given this class... public class Test { private long _id; public Test(long id) { _id = id; } } Will the .Net compiler actually compile it as... public class Test { private readonly long _id; public Test(long id) { _id = id; } } In other words, does it understand that _id is only ever set from the construct...

how can I iterate over a nested .NET List<> in Visual Studio 2008's Crystal Reports?

I have a Crystal Report in Visual Studio 2008 (C#). Its datasource is set programmatically at run-time to a .NET list, defined as follows: List<visit_volume> Visits a visit_volume looks like this: public class visit_template { private int _numberOfVisits; public int numberOfVisits { get { return this._numberOfVis...

How to Add window 7 visual style in winform application?

Dear All, I have to change the look and feel of my win form application of .net framework 3.5. So i want to add window 7 theme or visual style, Is any sample application available? and also suggest what to do change look and feel of my application? ...

Unbelievable strange file creation time problem

Hi, I have a very strange problem indeed! I wonder if the problem is in the framework, OS or maybe it's just me, misunderstanding things... I have a file, which might be created a long time ago, I use the file, and then I want to archive it, by changing it's name. Then I want to create a new file, with the same name as the old file had...

mvc route problem - using integer parameters

I have a route like this in my global.asax.cs: routes.MapRoute( "NewsArticles", "News/{page}", new { controller = "News", action = "Index", archive = false } ); How can I restrict access to this route so that it's only encountered if the user uses an integer? ...

Does a variable in occupy the same space in memory as when serialized?

if the class was had a SerializableAttribute and its object was serialized with BinaryFormatter, the serialized size is equal to the size it occupied in memory? Edit: Additional question: is there a better way to find how much space an object occupies in the memory? is this method approximate enough? ...

Configuration of webservice client

Hi, I've created proxy classes using svcutil with a given "sap crm" wsdl file. It worked great and it generated a output.cs. So added this output.cs in my visual studio project und created a simple test application. The test application can be compiled and even run, but I dont know why. I didn't enter any service url. How can this be ...

Overriding default key behaviour in a TextBox

I've just implemented a quick autocomplete feature in a textbox that pulls a string out of a fairly small list and "completes" the word. The TextBox caret stays at the location it was in from the last keypress, and the part of the word that the user has yet to type becomes highlighted, such that beginning to type something else will remo...

How to show Error & Warning Message Box in .NET/ How to Customize MessageBox

Using C# .NET (Winforms). I want to know how can I show the message boxes with a Ding!! sound & a red colored cross mark in it. This is what I'm talking about: How to do such things for my software, with custom errors and custom warnings? MessageBox.Show("asdf"); doesn't give me customize. ...

Problem Saving Silverlight 4 Business Application

I’m trying to create a new project using the Silverlight 4 business application template in Visual Studio 2010 beta 2. When I click “Save All” after the project is created I get build errors such as: The project file "..\BusinessApplication1.Web\BusinessApplication1.Web.vbproj" was not found. BusinessApplication1 Unable to open modul...

creating xdocument structure

I am trying to index a drive to a xml file. My pitiful attempt is this: internal static void createIndex(String path, String driveLabel) { XDocument w = new XDocument(); w.Add(createStructure(path, new XElement("root"))); w.Save(driveLabel +".xml"); } internal static...

How should I structure a community contribution code repository and solution?

I'm getting ready to launch a contribution project on CodePlex to provide a place where people can write and share extensions for another project that I have on there. This contrib project will be similar to the MEF-Contrib project in that multiple people will be able to submit items to the project that extend the core application. Now...

How do I Create an HTTP Request Manually in .Net?

I'd like to create my own custom HTTP requests. The WebClient class is very cool, but it creates the HTTP requests automatically. I'm thinking I need to create a network connection to the web server and pass my data over that stream, but I'm unfamiliar with the library classes that would support that kind of thing. (Context, I'm wor...

Is it possible to instruct WCF not to serialize fields, which values are the default for the field type?

Dear ladies and sirs. Inspecting the soap-xml produced by WCF I notice that many fields appear with their default values. Is it possible to instruct WCF somehow to omit such fields in serialization? Thanks. ...

Differences in OCX and DLL exception handling?

I know a (vc++) ocx is an ActiveX control, and a (vc++) dll is a collection of functions. I've found that being called from a vb.net application, the catching of some exceptions could behave differently if the exception is being thrown from inside the ocx or inside a function that comes in a dll. So my question is: From a point of view ...

ASMX Webservice project stop functioning after I published the code and upload it on live

I have created a website to enable webservices interact with my desktop application using soap. Now the problem is Webservices run fine when i run the website on my Local IIS. but they stopped when I published and uploaded the website by creating virtual directory. Now the problem is when I am requesting my webservice it is displaying a ...