.net

File Uploads via Web Services

Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client. ...

In .NET, will empty method calls be optimized out?

Title says it all, given an empty method body, will the JIT optimize out the call (I know the C# compiler won't). How would I go about finding out? What tools should I be using and where should I be looking? Since I'm sure it'll be asked, the reason for the empty method is a preprocessor directive. ...

Returning Large Results Via a Webservice

I'm working on a web service at the moment and there is the potential that the returned results could be quite large ( > 5mb). It's perfectly valid for this set of data to be this large and the web service can be called either sync or async, but I'm wondering what people's thoughts are on the following: If the connection is lost, the...

Best .NET Solution for Frequently Changed Database

I am currently architecting a small CRUD applicaton. Their database is a huge mess and will be changing frequently over the course of the next 6 months to a year. What would you recommend for my data layer: 1) ORM (if so, which one?) 2) Linq2Sql 3) Stored Procedures 4) Parametrized Queries I really need a solution that will be dynam...

sn.exe fails with Access Denied error message

I get an Access is Denied error message when I use the strong name tool to create a new key to sign a .NET assembly. This works just fine on a Windows XP machine but it does not work on my Vista machine. PS C:\users\brian\Dev\Projects\BELib\BELib> sn -k keypair.snk Microsoft (R) .NET Framework Strong Name Utility Version 3.5.21022.8 ...

Unit testing a timer based application?

I am currently writing a simple, timer based mini app in C# that performs an action n times every k seconds. I am trying to adopt a test driven development style, so my goal is to unit test all parts of the app. So, my question is: Is there a good way to unit test a timer based class? The problem, as I see it, is that there is a big ri...

Should I be worried about obfuscating my .NET code?

I'm sure many readers on SO have used Lutz Roeder's .NET reflector to decompile their .NET code. I was amazed just how accurately our source code could be recontructed from our compiled assemblies. I'd be interested in hearing how many of you use obfuscation, and for what sort of products? I'm sure that this is a much more important ...

FileNotFoundException for mscorlib.XmlSerializers.DLL, which doesn't exist

I'm using an XmlSerializer to deserialize a particular type in mscorelib.dll XmlSerializer ser = new XmlSerializer( typeof( [.Net type in System] ) ); return ([.Net type in System]) ser.Deserialize( new StringReader( xmlValue ) ); This throws a caught FileNotFoundException when the assembly is loaded: "Could not load file or assem...

Update database schema in Entity Framework

I installed VS SP1 and played around with Entity Framework. I created a schema from an existing database and tried some basic operations. Most of it went well, except the database schema update. I changed the database in every basic way: added a new table deleted a table added a new column to an existing table deleted a column from ...

SVN Revision Version in .NET Assembly w/ out CC.NET

Is there any way to include the SVN repository revision number in the version string of a .NET assembly? Something like Major.Minor.SVNRev I've seen mention of doing this with something like CC.NET (although on ASP.NET actually), but is there any way to do it without any extra software? I've done similar things in C/C++ before using b...

Have you ever reflected Reflector?

Lutz Roeder's Reflector, that is. Its obfuscated. I still don't understand this. Can somebody please explain? ...

How can I remove nodes from a SiteMapNodeCollection?

I've got a Repeater that lists all the web.sitemap child pages on an ASP.NET page. Its DataSource is a SiteMapNodeCollection. But, I don't want my registration form page to show up there. Dim Children As SiteMapNodeCollection = SiteMap.CurrentNode.ChildNodes 'remove registration page from collection For Each n As SiteMapNode In SiteM...

How to dispose a class in .net?

The .net garbage collector will eventually free up memory, but what if you want that memory back immediately? What code do you need to use in a class myclass to call myclass.dispose and free up all the used space by variables and objects in myclass? ...

In silverlight, how to you attach a changeEvent handler to an inherited dependency property?

How would you attach a propertychanged callback to a property that is inherited? Like such: class A { DependencyProperty prop; } class B : A { //... prop.AddListener(PropertyChangeCallback); } ...

Does System.Xml use MSXML?

I'm developing a C# application that uses a handful of XML files and some classes in System.Xml. A coworker insists on adding the MSXML6 redistributable to our install, along with the .NET framework but I don't think the .NET framework uses or needs MSXML in anyway. I am well aware that using MSXML from .NET is not supported but I supp...

Upload binary data with Silverlight 2b2

I am trying to upload a file or stream of data to our web server and I cant find a decent way of doing this. I have tried both WebClient and WebRequest both have their problems. WebClient Nice and easy but you do not get any notification that the asynchronous upload has completed, and the UploadProgressChanged event doesnt get called ...

.Net - Returning DataTables in WCF

I have a WCF service from which I want to return a DataTable. I know that this is often a highly debated topic, as far as whether or not returning DataTables is a good practice. Let's put that aside for a moment. When I create a DataTable from scratch, as below, there are no problems whatsoever. The table is created, populated, and r...

What is your preferred method of sending complex data over a web service?

It's 2008, and I'm still torn on this one. So I'm developing a web method that needs a complex type passed into it and returned from it. The two options I'm toying with are: Pass and return actual business objects with both data and behavior. When wsdl.exe is run, it will automatically create proxy classes that contain just the data...

What's the difference between struct and class in .Net?

I'm looking for a clear, concise and accurate answer. Ideally as the actual answer, although links to good explanations welcome. ...

What do ref, val and out mean on method parameters?

I'm looking for a clear, concise and accurate answer. Ideally as the actual answer, although links to good explanations welcome. This also applies to VB.Net, but the keywords are different - ByRef and ByVal. ...