by
PSteele via
Patrick Steele
on
2/24/2009 4:02:16 PM
Microsoft is planning a full-day of free presentations at it's Southfield, Michigan office on March 31st. ArcReady: Architecting for the Cloud, 9:00am – 11:45am, Register MSDN Events Unleashed (2 Sessions): (1) VS2008 Debugging and (2) Developing for Windows Mobile Devices, 1:00pm – 3:00pm, Register TechNet Events Unleashed: Windows Server 2008, 3:00pm – 5:00pm, Register Not only are these events free, but there will be prizes available for attendees (VS2008, Vista, Office, ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
2/17/2009 12:53:30 PM
Last week at AADND , I gave a presentation on MonoRail , the Castle Project's MVC implementation on ASP.NET. The MVC pattern is so popular (and productive!) among web developers, I'm sure you're aware that Microsoft is working on ASP.NET MVC – which is now up to RC1. If you're interested in learning more about ASP.NET MVC, Josh Holmes has a great series on building a simple photo gallery in ASP.NET MVC. It starts with the basics and adds more and more features with each p ... [ read more ]
|
by
PSteele via
Patrick Steele
on
2/17/2009 2:54:48 AM
I was playing around with Silverlight a little bit today and noticed something with the Checkbox UI element . It has both a "Checked" and "Unchecked" event. These obviously correspond to when the checkbox becomes checked or unchecked. This is in contrast to the WinForms checkbox which simply has a CheckChanged event. Interesting… Technorati Tags: Silverlight , Checkbox , .NET
|
|
by
PSteele via
Patrick Steele
on
2/3/2009 12:49:38 PM
One of my favorite bloggers, Eric Lippert , has a great post on the " properties vs. attributes " question. ...classes and structs and interfaces and whatnot are mechanisms that we use to implement model elements that represent the desired semantics in a manner that we as software developers find amenable to our tools . But let's be careful to not confuse the thing being modeled with the mechanisms we use to model it. Technorati Tags: .NET , Properties , A ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/20/2009 1:23:46 PM
I'm spending some time this morning getting caught up on RSS reading. A great post from last week from Brad Abrams on when you should use extension methods – i.e. when they are a good choice. As Brad Abrams points out: "While this a very powerful new feature, it does come with some new responsibility." Technorati Tags: .NET , Extension Methods
|
|
by
PSteele via
Patrick Steele
on
10/2/2008 11:48:50 PM
As I'm a big fan of Castle Project's MonoRail , I often get asked my opinion of the ASP.NET MVC stuff Microsoft is working on. And I always have the same answer -- I've seen some demos but haven't actually played around with it. So I took some time tonight and installed it. Installation You can download the ASP.NET MVC Preview 5 release here . Double-click on the MSI and you get the usual welcome screen. As always, there's a EULA to accept. After that, yo ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/23/2008 3:56:30 AM
As a sort of follow-up to my AJAX and MonoRail post , I've put together a small project showing how you can easily use JSON with MonoRail . I planned on posting a blog entry and the code tonight but instead, I decided to spend some time working on the AJAX and JSON section of the MonoRail Users Guide . It's my way of saying "Thanks!" to the Castle team for putting together (and supporting!) such a wonderful project. Documention always seems to lag behind features and MonoRail i ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/16/2008 2:23:12 AM
AJAX gives your web applications a better user experience. They'll get quicker feedback on their actions and it won't require a full page refresh. In this post, I'm going to review the basics of doing AJAX in MonoRail . A complete Visual Studio 2008 solution for this sample project is available from my Google Code page . Scenario For this demo, we'll have a dropdown listbox that allows the user to select a number. After selecting the number, we'll update an area ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/9/2008 6:51:52 PM
I've hopped on the FeedBurner wagon. If you're subscribed to my blog, please update your subscriptions to: http://feeds.feedburner.com/dotnetmvp If you're not a subscriber, why not subscribe now? Subscribe in a reader
|
by
PSteele via
Patrick Steele
on
9/9/2008 6:07:28 PM
I see it's been almost 2 years since I lashed out on Data Binding in .NET. Judging from the comments I received, it seems I'm not the only one who thinks this technology is not implemented very well. Nevertheless, I had a situation today where I thought Data Binding might be able to help me. Sure, I was very apprehensive, but I really thought data binding could help me out and reduce my work. Plus, despite my loathing of Data Binding and my continued bad experiences with i ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
5/7/2008 2:00:34 PM
The NHibernate FAQ has a new post about complex object graphs and lazy loading. If you use NHibernate (or, ActiveRecord -- which makes NHibernate a whole lot easier), it's worth a look. The technique described can greatly improve the way your app interacts with the database. OR mappers are nice, but you need to make sure you understand what is happening with the database calls that are made automatically by your OR framework. If you're using ActiveRecord , here's ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
5/5/2008 2:58:46 PM
Last week, Bill Wagner and I were providing some C# training for one of our clients. Bill showed the class how to use F12 to jump to the definition of a method. One of the students asked how to go back to your previous position and Bill didn't know the key binding off hand. As someone who comes from a VB6 background, I've maintained my VB6 keyboard mappings since I moved to C# in 2003. Navigating around inside the VS.NET IDE has been a no-brainer for me since all of the ke ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
2/19/2008 3:55:09 PM
At one time or another, we've all been asked to maintain or modify someone else's code. On those few occasions where the code is well organized and documented, we barely notice we're working. Coding is what we love to do and we do it. But, on occasion, we get the code written by someone who is not as skilled in practices, frameworks or methodology. This can lead to a frustrating experience when adding a simple feature or trying to fix a bug. We've all seen questionable cod ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/11/2008 2:25:43 AM
CodeMash was able to snag Scott Hanselman for this afternoon's keynote. As Steven Smith pointed out , Scott's intro slide deck was absolutely hilarious. His main talk on IIS7 was equally good. It's a great talk for those of us who've always thought of IIS as simply a web server. Scott showed us how much IIS7 has improved and should now be considered more of an application server -- for more than just Microsoft technologies (think PHP, Python, Ruby). Very cool. ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/3/2008 4:34:07 AM
I had a problem this past holiday weekend with a small website I was working on. I was doing some Forms Authentication (custom Forms Authentication in Monorail ) and couldn't get part of the code to work unless my website was the "root" website (i.e. http://localhost). Currently, the project is sitting in a virtual directory (http://localhost/virt1). I only found this out because I was so sure I was doing everything right the only thing I could think might be wrong was that some ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
8/27/2007 1:53:07 AM
I saw an interesting question posted in one of the Microsoft newsgroups today. I'll paraphrase here: I can use anonymous methods with something like the Thread class ctor: Thread t = new Thread ( delegate () { Console .WriteLine( "new thread" ); });
But if I try the same thing with Control.Invoke: this .Invoke( delegate () { MessageBox .Show( "Hello" ); });
I get an error: "Argument '1': cannot convert from 'anonymous method' to 'System.Delegate'
The problem ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
3/13/2007 1:28:07 PM
Bill Wagner explains a bit about C# 3.0's local type inference : Of all the features in C# 3.0, local type inference is generating the most questions and misunderstanding. You know, ‘var’. The fact is local type inference is not as scary as it seems. In fact, you’re not losing strong typing. It’s a simple time saver that is actually necessary to support anonymous types.
|
|
by
PSteele via
Patrick Steele
on
2/20/2007 1:19:42 PM
Just saw this on Jason Bock's blog . Lutz Roeder has released version 5.0 of Reflector. And getting it is so easy: Just launch your current version of Reflector (I assume you already have it!), go to the Help menu and select "Check for Updates". It will download, install and re-start! UPDATE: Check out Scott Hanselman's annoucement with a bunch of tips to get the most out of Reflector -- although I think world domination is a bit of a stretch! :)
|
by
PSteele via
Patrick Steele
on
2/20/2007 1:15:01 PM
If the new C# 3.0 "=> operator makes you feel uneasy, check out Dustin Campbell 's post where he gently introduces you to lambdas by taking a simple C# 2.0 algorithm using anonymous methods and converts it to lambdas in C# 3.0.
|
by
PSteele via
Patrick Steele
on
2/20/2007 2:05:18 AM
In a recent thread on the .NET newsgroups, someone asked how they could create a "utility" assembly, but they only wanted their applications to be able to use the assembly. I couldn't think of a good way, but Dave Sexton replied with an interesting little gem on the StrongNameIdentityPermissionAttribute . After reading his response I made myself a little "to do" item to implement his idea and post some sample code. Today, I came across a blog post from Morgan Skinner that exp ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
2/6/2007 2:38:03 PM
I've created a simple reproduction case highlighting a problem I recently had with COM interop. I've got a VB6 app using a .NET 2.0 component exposed to COM. The component in this sample is pretty simple: using System;
using System.Runtime.InteropServices;
namespace DotNetLibrary
{
[ Guid ( "FF7E820A-9F60-4B4C-BE17-93704377A65F" )]
public interface IClass1
{
[ DispId (0x60030011)]
int TheMethod(
[ MarshalAs ( UnmanagedType .Sa ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
2/2/2007 10:59:43 PM
I had some pretty simple code that checked if an array of integers was in ascending order. I needed to check a second list to see if it was also in ascending order. The only problem was that is was an array of doubles. The logic is identical for both lists. The only difference is the type of data acted on. This is where generics shine! I pulled the old code into its own static method and used generics so I could use it on any array of objects that are comparabl ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
2/1/2007 2:02:12 AM
In an earlier post , I had talked about a Windows service I was working on. This service periodically performs an HTTP GET request to check if a device that accepts incoming HTTP requests is still working. It was pretty simple to perform the GET with .NET -- something I'm sure many of you have done hundreds of times before. Everything worked fine, except that after a while, I couldn't connect to the remote device and was getting a timeout. The other developer working on the ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/31/2007 4:18:39 PM
Neil Cowburn has a very interesting post on using ILMerge with Compact Framework apps . It seems that, by default, ILMerge always uses the .NET Framework Assemblies. Neil talks about the targetplatform and platformdirectory command-line arguments that can be used to tell ILMerge to use the proper assemblies (the Compact Framework Assemblies in this case).
|
|
by
PSteele via
Patrick Steele
on
1/23/2007 4:02:59 PM
As noted in a previous post , I'm now using Subversion (SVN) for source code control of my mobile blogging app (along with a couple of other projects sitting on my hard drive). Here's a quick "how to" on getting Subversion running under Windows XP with VS.NET integration. 1. Download TortoiseSVN . As the website says, it's the coolest interface to SVN (to be accurate its both SVN and an SVN client all-in-one). The download page has installers for both 32-bit and 64- ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/12/2007 5:33:23 PM
I'm a simple man so I couldn't think of any way to mix these three (especially since I've cut back on beer consumption as it can aggravate my heart arrhythmia). However, local blogger David Redding (VP of the Ann Arbor .NET Developers ) has found one. And to top that, he's even weaved it into a wonderful tutorial on C#'s "yield return" feature. Check it out !
|
by
PSteele via
Patrick Steele
on
1/12/2007 4:35:22 PM
At my current contract, I've done three brand new applications from scratch and have been involved in modifying a couple of others. Every developer has their own coding style and it can be sometimes difficult to come up to speed on how someone else has decided to code a particular application. What I've found myself doing more and more is documenting ( using XML comments ) the private methods of these apps I need to modify. When I find a method and the name isn't descript ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
1/8/2007 8:40:36 PM
I had a short project during the Christmas/New Year's break. I had to create some CCW 's (COM Callable Wrappers) for a client that wanted to replace some existing COM objects with new .NET objects. The requirement was that the existing COM clients (built with early-binding) would not need recompiling. They have a product that allows their customers to write their own extensions. So requiring hundreds of clients to recompile all of their extensions was something they wan ... [ read more ]
|
by
PSteele via
Patrick Steele
on
1/8/2007 5:11:48 PM
After getting my new phone in November, I started searching all over for information about mobile development. I ran across the Windows Mobile Team Blog and was fascinated by the articles written by Mike Calligro (or "MikeCal" as displayed on the blog). I read one and had to read his next, and next, etc... With titles like " The Emporer Has No Close " and " Paging Dr. RAM ", how could you go wrong? The articles are a fun and entertaining look into the mobile form fac ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
11/27/2006 3:30:51 PM
I was doing some work with VSS 2005 this weekend and had a very wierd problem. When I tried to view history for a file, nothing happened. No errors, no prompts -- it just did nothing. I tried this both from VS.NET 2005 as well as the VSS 2005 client. Same thing. So I did a little googling and found quite a few hits for this problem. One of the solutions I found worked so I stuck with it. Start up the VSS Admin utility. Go to Tools, Options. Click on the ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
11/9/2006 9:01:01 PM
My post about the utility method IsNullOrEmpty elicited an important comment . It seems there is a JIT optimization bug with this method that will bite you if you compile in release mode and run outside of the IDE. Seems like it might be best to avoid this one and wait for the fix. Thanks to Arjan Zuidhof for the comment!
|
|
by
PSteele via
Patrick Steele
on
11/1/2006 8:16:28 PM
How many times have you written the following string validation code: if (_name == null || _name.Length == 0)
{
// ...
}
With .NET 2.0, you can use the static ("Shared" in Visual Basic.NET) utility method String.IsNullOrEmpty to do the same thing: if ( string .IsNullOrEmpty(_name))
{
// ...
}
|
|
by
PSteele via
Patrick Steele
on
10/21/2006 2:39:03 PM
A guy at a client site quizzed me the other day on an interesting topic. Given the following snippet of code: double value1 = ... ;
string s = value1.ToString();
double value2 = double .Parse(s);
Assume 'value1' is just some random value. Will 'value1' and 'value2' always be the same?
The answer is No. With the parameterless ToString(), .NET will use the "G" (General) Numeric Format String . If you want to guarantee a round-trip conversion from double-to- ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
10/10/2006 10:36:17 PM
Please excuse this minor tirade I'm about to belch out... I've never been a fan of automatic data binding. I still remember the full page ads in Visual Basic Programmers Journal showing sample screenshots of an Access employee databased hooked in to a VB3 for with very little coding. It looked sweet and demo'd well, but in practice, the data binding was never good enough for production work. As I recall, VB4/5/6 didn't show any big improvements in data binding. .NET ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/24/2006 7:49:42 PM
Although I liked the ease at which I could get my source code highlighted with the squishyWARE Syntax Highlighter component , I didn't like that is was VS.NET 2003 coloring. So I got the crazy idea of just pulling the RTF off the clipboard and converting that to HTML. I spent a few hours last night and a couple of hours this afternoon writing a rudimentary RTF parser. It's ugly and doesn't support most of the RTF syntax, but it gets me some nicely formatted HTML from the RTF on ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/23/2006 6:13:19 PM
I've been playing around with writing a syntax highlighting plugin for Windows Live Writer Beta . It allows me to paste some C#, VB.NET or XML code into a textbox and then uses the squishyWARE syntax highlighter to set HTML coloring. Fun (and easy!). Great for code samples. Here's some output: public class RowStatus
{
public const int BadMap = 1;
public const int BadBaro = 2;
public const int BadCA50 = 3;
}
It's not the sam ... [ read more ]
|
by
PSteele via
Patrick Steele
on
9/23/2006 3:24:00 PM
I was reviewing some code I had ported from VS2003 today. The project was using visual inheritence in a windows forms enviroment. At one point (back when it was in 2003) I had marked the class abstract since, well, it was abstract. Unfortunately, I could no longer use the VS2003 forms designer to edit the form -- since the class was abstract, the IDE couldn't create an instance of it. At that time, I just added some comments to the code that the class should not be ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/22/2006 7:51:57 PM
I've been spending some time today documenting my code. I'm using .NET's built-in XML comments and an alpha build of nDoc 2.0 that supports .NET 2.0 assemlies. So far, it's been going pretty smoothly (for an alpha). It seems quite stable and I haven't run into any show stoppers. I noticed that it now catches if you miss a <value> tag on your properties -- nDoc 1.3.1 didn't consider that a missing value. And I have one class with only two parameterized cons ... [ read more ]
|
by
PSteele via
Patrick Steele
on
9/22/2006 3:10:52 PM
Just found out about this at our user group meeting the other night: http://www.codemash.org/
|
|
by
PSteele via
Patrick Steele
on
9/21/2006 3:21:39 PM
The .NET 2.0 Forms Designer has an awesome new feature called Snaplines . Snaplines show visual cues to help you line up controls on a form. They make it very easy to conform to the Windows User Interface Guidelines. But if you're in a situation where you want percise control over placement of a control, simply hold down the ALT key while you're dragging. The snaplines don't appear and the control won't try to "snap" itself into one of the potential alignment positions.
|
|
by
PSteele via
Patrick Steele
on
9/20/2006 7:06:35 PM
I'm geeked about tonight's user group meeting. We've got IDesign's Brian Noyes in town to talk about ClickOnce development and deployment. Should be an awesome talk! If you're in the southeast Michigan area tonight (Southfield, to be exact ) stop on by. More information on the GANG website .
|
by
PSteele via
Patrick Steele
on
9/20/2006 7:00:36 PM
In a follow-up to my last post , Eric Bachtal pointed out that I could use a class with only public constants to accomplish just about the same thing: public class RowStatus { public const int BadMap = 1; public const int BadBaro = 2; public const int BadCA50 = 3; } Great idea! And I'm surprised I forgot about that since I used this very technique about 4 years ago when I had to do some Java coding. Without Java sup ... [ read more ]
|
by
PSteele via
Patrick Steele
on
9/20/2006 2:12:44 AM
I'm using a library that accepts an integer as a parameter. The value for the integer is really arbitrary -- it's a utility library and the consumers of the library decide what they want this integer value to represent. For my application, I needed this integer to represent the reason some values were being filtered out of a set of data. I originally defined an Enum for my values: enum RowStatus { BadMap, BadBaro, BadCA5 ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
9/19/2006 2:02:01 PM
When we work in a managed environment (.NET) for so long, we sometimes forget there is still unmanaged code out there. At my current contract, I've been using MATLAB for some heavy numerical processing. The creators of MATLAB, MathWorks , have a tool called the MATLAB Builder for .NET . This allows me to create a .NET wrapper around a MATLAB function that can then be used easily by any .NET code. It's been working flawlessly for the past few months. Two weeks ago, we m ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
8/7/2006 1:28:33 PM
In another follow-up to the thread I mentioned in my previous post , Ian Griffiths talks about some common misunderstandings about how .NET’s Garbage Collector works and how you interact with it via IDisposable. In this reply he also mentions:
The two widely believed GC falsehoods: "I don't have to free stuff - the GC does it for me" and "The GC calls Dispose" - are two of the biggest barriers to understanding and working effectively with non-memory resources.
Share t ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
8/4/2006 1:19:10 AM
Vince asks a question about handing out Disposable objects: Lets say I have a class that has a method that returns a new DataSet: public DataSet GetData(); I'll have no control over the DataSet being disposed. As an object creator is it my concern that the object I created eventually gets disposed or should I not care and trust that the consumer of this method will do the right thing? A good thread to read. I especially liked Frans’ response: When you buy a happy me ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
8/1/2006 3:04:16 PM
Just found out something odd that I never noticed before. If you use the OpenFileDialog class to allow a user to select a file, then once they’ve selected a file, the directory that file is in is now your application’s current directory! Huh? Seems odd to me.
There’s an easy workaround. The OpenFileDialog class has a RestoreDirectory property (actually, it comes from the base class FileDialog) which you can set to true to disable ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
7/27/2006 10:27:43 PM
I had a chance to play around with the FTP classes in .NET 2.0 (FtpWebRequest and FtpWebResponse). My initial impression (after about 15 or 20 minutes of coding) is, yuck — not very good. First off, as Justin Rogers pointed out two years ago in the betas, they’ve wrapped a stateful protocol into the existing, stateless WebRequest model. Very wierd design, in my opinion. Second, the FtpWebRequest has a “Method” property that allows you to set the command you want to send to ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
7/25/2006 9:03:30 PM
Jim Holmes says
FrazzledDad: We Have a Cover! .
One of the reasons my blogging diminished quite a bit (besides hunting for a job) was that I was asked by Jim Holmes to write an ILDASM article for the upcoming book he’s co-authoring with James Avery . It seems a cover has been selected. Very cool! I had a great time writing the article and Jim Holmes was super-easy to work with. Thanks for the opportunity!
Share this post: Email it! | bookmark it! ... [ read more ]
|
|
by
PSteele via
Patrick Steele
on
6/16/2006 9:35:00 PM
I needed to get the device ID from a Windows CE device for a recent project I worked on. Some googling found many discussions as to whether it was possible on all devices and whether is was even possible via managed code. Then I found a blog entry by Microsoft's Jeremy Hance that put it to rest: A Simple Device ID Class
Share this post: Email it! | bookmark it! | digg it! | reddit!
|
|
by
Patrick Steele via
Patrick Steele
on
4/11/2006 11:53:00 AM
Someone emailed me with a request for sample code from my second COM Interop Exposed article on 15seconds.com . Since they didn't leave an email address where I could send them the ZIP file, I just decided to post it here:
COMInterop2.zip
|
|
by
Patrick Steele via
Patrick Steele
on
3/29/2006 11:29:00 AM
Thanks Nils ! I was having problems with a MasterPage layout and could not figure out what was going on. VS.NET kept telling me "Could not match '...' with any ContentPlaceHolder". Despite the fact that there was indeed a ContentPlaceHolder with the proper ID. I gave up and Googled. Although blogger Nils Gruson has but one blog post , it was exactly what I was looking for!
It seems that Microsoft is aware of the problem (it was reported back in Beta 1). As noted in Nils post, just u ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
3/24/2006 12:25:00 PM
About two years ago, I blogged about that stupid (IMHO) setting for VS.NET 2003 that would hide "advanced" members from intellisense in VB.NET. In VS.NET 2005, this option is not only off by default, but the checkbox is disabled. Nice.
But wait! I was trying to install a VS.NET 2005 add-in today and couldn't find a particular option in VS.NET 2005. I went through all of the options listed (the list seemed a little "light") and could not find what I was looking for.
Then I noticed ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
3/22/2006 2:08:00 PM
My latest article on COM Interop is up at 15seconds.com . COM Interop Exposed - Part 2 shows what you need to do in your .NET objects so that your events are exposed to your COM clients. I start with a history of how events work in COM, and then show how to use interfaces and attributes for easier integration with your existing COM clients.
|
|
by
Patrick Steele via
Patrick Steele
on
2/23/2006 10:21:00 PM
If you've ever used the EventLog class , you know it's a convenient way to write entries into any of the event logs on a machine. The WriteEntry method has a number of overloads and one of them allows you to specify an EventLogEntryType member to indicate the type of event log entry to create -- Information, Warning, Error, SuccessAudit or FailureAudit.
Now suppose you're using the EventLogTraceListener class to write trace messages out to the event log. You may notice that all of yo ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
2/22/2006 10:18:00 PM
I ran into an interesting issue today when changing some VB.NET code. I was surprised at the outcome so I did a quick repro case in C# and didn't have a problem.
Given this simple C# app, the results are pretty easy to predict:
using System;
namespace InheritIssue
{
class Class1
{
[STAThread]
static void Main( string [] args)
{
Foo f = new Foo();
}
}
public class Base
{
private int _data;
public Base()
{
Init();
}
protected virtual ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
2/19/2006 10:52:00 PM
Tomorrow begins my final week as a W2 employee. As of Monday, February 27th I become an independent contractor!
Through our local user group , I've built up a relationship with a local consulting company, SRT Solutions . They recently contacted me to see if I knew anyone for a position they were trying to fill in the automotive sector. I didn't really know anyone looking. Then they asked, "Would you be interested?". I thought it over for a few days and did some additional research, ask ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
9/22/2005 10:36:00 PM
Want a free copy of VS2005? Check out the " Launch Tour 2005 " site:
Join us for a Launch Tour 2005 event and receive SQL Server 2005 and Visual Studio® 2005
Free admittance. Free software (VS2005 AND SQL Server 2005!!). You can't go wrong there folks.
Register today!
|
|
by
Patrick Steele via
Patrick Steele
on
9/8/2005 9:50:00 PM
You're being a good developer and running your class library code through FxCop to see how well your code is following Microsoft's .NET Framework Design Guidelines . You've got a pretty harmless section of code like this:
Shared Sub Foo( ByVal x As Object )
If TypeOf x Is Module1 Then
Dim m As Module1 = DirectCast (x, Module1)
m.Main()
End If
End Sub
FxCop spits out warning:
Do not cast unnecessarily
Why are you getting this erro ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
8/8/2005 9:09:00 PM
A while back I blogged about some interesting IL generated by the VB.NET compiler . Basically, VB.NET allows you to set a value type to Nothing and the resulting IL seems overkill. Today, while I was googling for something .NET related I found Dan McKinley's blog . Earlier this year he had blogged about this very same thing and got a comment from Paul Vick (Technical Lead on VB.NET @ Microsoft) that this was actually a bug in the VB.NET compiler that has been fixed in VB 2005. Good to ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
7/12/2005 10:44:00 PM
Our local user group president Bill Wagner is presenting an MSDN webcast on July 29th at 2:00pm EST. The topic will be " Understanding Avalon ". Sounds very interesting!
|
|
by
Patrick Steele via
Patrick Steele
on
6/16/2005 11:35:00 PM
The recently released 1.2.9-beta of log4net contains a new appender -- TelnetAppender. This appender acts like a telnet server and allows telnet clients to connect to it and monitor log4net's trace messages. I've only used log4net 1.2.8 but the TelnetAppender sounded pretty neat so I had to try it out. Here's a quick sample app I did. Note the DOMConfigurator has been deprecated and I'm now using the XmlConfigurator:
Option Strict On
Option Explicit On
Imports System.IO
Imp ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
6/3/2005 3:39:00 PM
A few days ago I posted about my surprise on finding out what IsNothing() really does . After reviewing more code I found out another reason you should avoid this: It accepts value types! Obviously, since IsNothing() is a function that accepts an 'object', you can pass anything you want to it. If it's a value type, .NET will box it up into an object and pass it to IsNothing -- which will always return false on a boxed value!
This really is a discipline issue and you shouldn't be checking ... [ read more ]
|
|
by
Patrick Steele via
Patrick Steele
on
5/31/2005 9:52:00 PM
While reviewing some existing code at my new job I noticed that they use the VB.NET IsNothing() function instead of using the "Is Nothing" syntax. I didn't even know there was an "IsNothing" function so I compiled some code and checked it out with ILDASM. Here's what I compiled:
Public Sub Foo2()
Dim o As AppDomain
If IsNothing(O) Then
Debugger.Break()
End If
End Sub
At the resulting IL is:
.method public instance void Foo2() cil managed
{
... [ read more ]
|
|