.net

.NET framework: new features

A few weeks ago I changed the target .NET framework for my application to the 4th version. Recently my Resharper told me that my variable "MetaDescription" hides property string System.Web.UI.Page.MetaDescription After small investigation the piece of code that worked earlier: HtmlMeta MetaDescription = new HtmlMeta(); MetaDesc...

How to send SMS via SMPP using mblox?

Is there any open source scripts or resources available to inetegrate mblox using SMPP in .net framework ? ...

Looking for best practise for writing a serial device communication app

I am pretty new to serial comms, but would like advise on how to best achieve a robust application which speak to and listens to a serial device. I have managed to make use of System.IO.SerialPort, and successfully connected to, sent data to and recieved from my device. The way things work is this. My application connects to the Com Po...

C# Possible to partial class "program" class for a console application?

I was wondering if its possible to change the default "program" class that gets created for any console application to a partial class. I want to do this because I want better organisation rather than have all methods in 1 file categorized by region. It would make more sense for me to have certain method categories sitting in separate ...

Is locking on the requested object a bad idea?

Most advice on thread safety involves some variation of the following pattern: public class Thing { private readonly object padlock = new object(); private IDictionary stuff, andNonsense; public Thing() { this.stuff = new Dictionary(); this.andNonsense = new Dictionary(); } public IDictionary S...

[.NET] What's the point of MarshalByValue Object?

Hi awesome! We know that MarshalByRef allow us to create an object in a different AppDomain and use a Proxy object to access it. And the behavior of that object is in a different context of the AppDomain where it actually lives in. Well this sounds fairly reseaonable in the regard of isolation and safety. But why is there still Marshal...

want a silverlight listbox with vertical marquee like effect

i want a silverlight listbox whose items are automatic scrollable (like a vertical marquee) ...

How does .NET applications probing for their configuration files?

I know there's some kind of assembly probing process. Is there a similar process for looking for config files? If there is, what exact process is it? How could I customize it? Many thanks. ...

Access .NET dll's method using Java code

I have a dll namely product.dll created using .NET. How can I access that dll's constructor or method using Java code. Is it possible to access without using JNI? ...

Calling a Java API from .NET - best approach

I need to call an API that's all in java from an existing .NET codebase. What's the best approach here? Writing a webservice in java that basically just forwards the calls to the API - or going with something like JNI4NET? ...

Average function without overflow exception

.NET Framework 3.5. I'm trying to calculate the average of some pretty large numbers. For instance: using System; using System.Linq; class Program { static void Main(string[] args) { var items = new long[] { long.MaxValue - 100, long.MaxVal...

SmtpClient.SendAsync() does not work anymore

Hi All, I have recently purchased a new computer, and now my e-mails never get sent, and there are NEVER any exceptions thrown or anything. Can somebody please provide some samples that work using the SmtpClient class? Any help at all will be greatly appreciated. Thank you Updates Ok - I have added credentials now. And can SUCCESSFUL...

How do I determine "Network Location" in .NET?

In Windows 7 (and Vista I think), a network you're connected to is assigned to a "location" e.g. Home / Work or Public. Is it possible to determine the current network location programatically? ...

how do we call client script from asp.net server side script?

how do we call client script from asp.net server side script? ...

Handle leaks with .NET System.Threading.Thread class

I've a problem that number of Handles in my app is continuously growing. I did the debugging and recognize that this is caused by System.Threading.Thread class which is used for some routine. To simplify the debugging I’ve created a sample .NET application: ... private void button1_Click(object sender, EventArgs e) { ...

How do I unit test a finalizer?

I have the following class which is a decorator for an IDisposable object (I have omitted the stuff it adds) which itself implements IDisposable using a common pattern: public class DisposableDecorator : IDisposable { private readonly IDisposable _innerDisposable; public DisposableDecorator(IDisposable innerDisposable) { ...

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

This is a question asked before, both here on Stack Overflow and other places, but none of the suggestions I've found this far has helped me, so I just have to try asking a new question. Scenario: I have a simple Windows Forms application (C#, .NET 4.0, Visual Studio 2010). It has a couple of base forms that most other forms inherit fro...

Is there an Open Source Profiler for .Net 4?

Is there an Open Source Profiler for .Net 4? RedGate Antz is an option but I am looking for an open source alternative. ...

Extract enumeration data from .XSD file

Hi, I am trying to read enum from a XSD file. The schema is as follows <xs:schema id="v1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="unqualified" elementFormDefault="qualified" msdata:IsDataSet="true"> <xs:simpleType name="Type"> <xs:restriction bas...

How to serialize a data of type string without using StringWriter as input

I want to serialize a input data of type string, but do not want to use StringWriter and StringReader for for serializing/Deserializing. The reason for this is when a escapse chars are sent as part of the Input string for serializing, it is serialized but some Spl chars are inserted in the xml(eg:"").I'm getting an XMl error while deser...