.net

svcutil.exe - Proxy generated not allowing for nullable fields

I am trying to consume a web service specified using WSDL by creating a WCF proxy using svcutil.exe, but the WSDL specifies that some of the operations have parameters that are optional (minOccurs="0"), for example: <xs:element minOccurs="0" maxOccurs="1" name="meetingId" type="xs:int" /> Unfortunately, the generated proxy does not al...

What value is the ThreadState Property?

This question got me thinking about the .NET equivalent. What value is there to the ThreadState property of the Thread class? In this code example: if (someThread.ThreadState != System.Threading.ThreadState.Running) { someThread = new Thread(SomeMethod); someThread.Start(); } The someThr...

Handling massive in memory objects in .NET

hey guys, here's the issue, Essentially, I have a very large List containing in turn relatively large Dictionaries So basically, I have a very big in memory collection. I then serialize this collection manually to XML, and send it over http. needless to say, the XML is too large, sometimes so large I get an OutOfMemory exception befor...

Will duplicate lamda expressions resolve to the same generated code?

This is a simple question. If the content of two lambda expressions in the same class are exactly the same, will the compiler generate and use one backer method, or will it generate a method for each instance? Example ctl.MouseOver += (sender,e) => UpdateStatus(); ctl.MouseOut += (sender,e) => UpdateStatus(); Does this generate one o...

Linq + Invalid expression term '>'

Can anyone help me here, the following works fine on my xp but not my vista machine. Im querying a Generic dictionary. Both computers have .NET 3.5 + SP1, 3.0, 2.0, etc., and have the web project targeted to 3.5 Framework. using System.Linq; string val = "Test"; var d = DictionaryOfStuff().Where(n => n.Key.ToLower().Contains(val.ToLow...

FieldInfo.SetValue vs Type.InvokeMember(fieldName, BindingFlags.SetField)

What is the difference b/w using FieldInfo.SetValue vs Type.Type.InvokeMember(fieldName, BindingFlags.SetField, ...) ? ...

There is any way to make Visual Studio self hosted ASP.NET applications to receive external connections?

I can't GET any of the pages hosted on my development machine externally, even after opening an exception at the Windows firewall. ...

Are there any useful libraries for .NET Console applications?

Hi, I'm wondering if there are any useful (free) libraries out there to help the development of Console applications. Just a simple example: What about a library that encapsulates all the behaviour to select files in a console application (aka the OpenFileDialog for Console applications). There's MonoCurses of course, but I'm wonder...

Managing multiple configuration files in Visual Studio for a C# project

I have learned that builds should be very straight forward and requires less human intervention. In my situation, I have 3 environments, DEV (development version), SIT (STG integration testing) and UAT (user acceptance testing). All these environments have different database connection details and other settings (such as logging). Curr...

10035 error on a blocking socket

Does anyone have any idea what could cause a 10035 error (EWOULDBLOCK) when reading on a blocking socket with a timeout? This is under Windows XP using the .NET framework version 3.5 socket library. I've never managed to get this myself, but one of my colleagues is getting it all the time. He's sending reasonably large amounts of data to...

Microsoft Sync Framework - How Does Bidirectional Sync Work?

I have two clients A and B. Both clients have identical, synced local data caches. If client A makes an offline edit to record X and then client B also offline edits record X and syncs with the server, when client A syncs with the server, the change that client B made is not reflected and no amount of bidirectional syncing makes the tw...

EF Distinct (IEqualityComparer) Error

Good Morning! Given: public class FooClass { public void FooMethod() { using (var myEntity = new MyEntity) { var result = myEntity.MyDomainEntity.Where(myDomainEntity => myDomainEntity.MySpecialID > default(int)).Distinct(new FooComparer); } } } public class FooComparer : IEqualityComparer<MyEntity.My...

How Proxy gets created for SAO when client and server share same interface in Remoting

I have doubt realted to SAO object. Fo eg. I have Interface ITest which is in ITestObj.dll and RemoteObject(which is registered as SAO) Test which implements ITest in a server called RemoteObject.dll. Now my client just uses ITestObj.dll and try to create the proxy object using Activator method. As per MSDN- GetObject or new can be used...

How do you get the Name of the Property

Possible Duplicate: Print property name (not what you would think) Possible Duplicate: Print property name (not what you would think) How do you get the name of the property from the property itself for example theres a property Myproperty and i want to get Name of Myproperty from the property Myproperty, something lik...

How do Threads work in Objects

hey guys, I'm totally inexperienced in terms of threads, so here's my question: How do threads work within an instance of an object, in particular, I'm working on a Windows Service. So, my Service is basically an instance of an Object right? So, say I have a System.Timers.Timer in my Service, and that fires an ElapsedEventHandler ever...

How can I send emails through SSL SMTP with the .NET Framework ?

Is there a way with the .NET Framework to send emails through an SSL SMTP server on port 465? The usual way: System.Net.Mail.SmtpClient _SmtpServer = new System.Net.Mail.SmtpClient("tempurl.org"); _SmtpServer.Port = 465; _SmtpServer.EnableSsl = true; _SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password"); _S...

How to find out what databses are on a server programmaticaly?

Is there any way I could find out programmaticaly what databases exist on a server? It's because I would like to show user all available databases and allow him to choose the one he's interested in. ...

Inheritance of LINQ to SQL data context

If I inherit one DBML file from another DBML file, is it possible to visually create associations to the data classes from inherited DBML? ...

InvalidOperationException while SOAP serialization of complex type

Hi guys, I encountered a problem with SOAP serialization and it would be great to find an answer. Here's a very simplified example: public void Test() { StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); SoapReflectionImporter importer = new SoapReflectionImporter(); XmlTypeMapping map =...

How can I create a control with IPAddress properties that can be edited in the designer?

I'm creating a control with properties of type System.Net.IPAddress. The designer shows these as read-only, and seems to be matching them up with resources. Is there a way to make it so that the user can edit these properties in the designer properties window, rather than having to open up the resource editor? ...