Tag | C# Posts

http://dotnetradio.com/arch... Andrew sits down with Atif Aziz. Atif Aziz is a senior IT business analyst at Cargill International and an ex-Microsoftie. His primary focus is helping customers move to the .NET Framework. He speaks regularly at Microsoft conferences and can be reached through his web site. You can find out more about Atif Aziz by visiting his web site www.raboof.com. Raboof.com = FooBar!! Atif describes to us what ELMAH is and the history behind it. He then ...
I stumbled across this series of posts by Maarten Struys and Dougturn on "Getting started with windows mobile development with Visual C#". I remember Joel too having mentioned it in one of his posts. I went through a couple of articles and was able to create a few basic applications in C#. I must mention that creating a basic application with your menus and a few controls takes no time at all in visual C#. The visual designer is nice, supports a lot more controls and takes care of things that you ...
I've been very frustrated with the lack of flexibility with wordpress.com hosted blogs, so I am yet again moving. This time I wanted to host my own instance of Subtext but discovered that geekswithblogs.net uses Subtext and figured I would give one last attempt to a hosted community online :) I guess I just don't want to deal with running my own server just for a blog. The most important thing I wanted back was Syntaxhighlighter which was about impossible to use with wordpress.com without paying ...
Summary : The following is a step by step reference to creating projects for on demand downloading and using in Silverlight. After reading through various ideas by David Poll, Brad Adams I find this method convenient and fast to implement. This post is just a reference post for future usage in new projects. Technology used : Silverlight 3.0, MEF , VS 2010 Preferred Language : C# 4.0 Dlls Needed : System.ComponentModel.Compo... References : Silverlight 3 Navigation: Dynamically Loaded Pages… Now ...
Tomorrow night I’ll be at RockNUG presenting LINQ to SQL. Yes, LINQ to SQL. Again. In the last 2 years I have presented LINQ to SQL numerous times at various user groups and code camps. Why do I keep getting asked to present LINQ to SQL? Isn’t LINQ to SQL dead? Answer: No. LINQ to SQL is not dead! This confusion all started back in October 2008 with a seemingly innocuous post on the ADO.NET team blog discussing the emphasis that Microsoft was going to put into the Entity Framework going forward. ...
In a project that I completed a few years ago I had need to programatically zip an xml file for use as an email attachment. This specific implementation was a part of a BizTalk Adapter written in VB.Net, but the code library used to carry out the zip process was a freely available C# library that can be used in any .Net code for zipping purposes. The library used was called SharpZipLib. The .Net SharpZipLib library (formally NZipLib) supports Zip as well as GZip format and comes with C# source code ...
In the first post in this series, I provided a little info on the HandleError attribute in MVC 1. In case you don’t want to flip back, the HandleError attribute can decorate a method or a class and will push your users to a generic errors view provided customErrors is “On” or “RemoteOnly”. There’s a little more to it, but that’s all the background we need for this post. The out-of-the-box HandleError attribute works well, until you’re in a scenario where you need to do more than hide your errors. ...
You remember the previous post on dynamic. We will today look into it in a bit more detail. Yeah, let's ILDASM it and try and identify what is going on under the hood. But for the context of the post let's look at a simpler tale. namespace Coderslog.Net4.Samples { public class SimpleDynamic { public void CallDoSomething() { var instance = GetDoSomething(); instance.DoSometing(); } private dynamic GetDoSomething() { return new BehaviourA(); } } } A very basic class, hmmm which roughly translates to ...
Lets examine the dynamic key word introduced in .Net 4.0. It can keep an instance of any type. Then what is the difference between it and System.Object. Well the essential difference between them is the dynamic method dispatching which enables lazy binding, i.e. it allows you to write method, operator and indexer calls, property and field accesses, and even object invocations which bypass the normal static binding of C# and instead gets resolved dynamically. It provides a unified approach to selecting ...
On Saturday November 21st the Dutch .net usergroups SDN, VBCentral and my own dotNed will host the third annual CodeCamp. This time it will take place in Rotterdam. As with all CodeCamps, attending the event is free provided you register first at the http://www.codecamp.nl site. on this day Freena Eijffinger (from NSquared) and myself will present a session on development on Surface. I am currently hard working on the content of it, but now it looks like Freena and I will split up the talk in two ...
Hello Guys, I have sample here on how to create a simple Create, Read, Update, and Delete on Database. This sample created on Visual Studio 2010 Beta 2 using C# and Asp.Net. I did'nt include a validation on this sample. I only want to show on how to Select, Insert, Update, Delete on Database. For those who beginners I hope it will help. You can now download my Sample File at this Link ...
I’ve been using ASP.NET MVC Release 1 for a bit now, and while it’s definitely not for every application, I happen to like it quite a bit. There has been a lot of activity on MS-centric blogs regarding MVC, but there are still some really mundane tasks that there could be more information on. So, this series of posts isn’t going to be anything crazy; it will, however, illustrate what options you have to do centralized error-handling using MVC 1. We’ll start at the beginning… The System.Web.Mvc.dll ...
Next Monday (9th Nov 2009) at 9am I will be delivering an overview of the new stuff in Entity Framework 4 at TechEd Europe. The session is DEV305 and the description reads: ADO.NET Entity Framework in Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 (catchy?) This presentation offers an in-depth discussion demonstrating the new capabilities of the Entity Framework that will ship with Visual Studio 2010. The second release of the Entity Framework focuses on addressing two primary customer ...
I have previously mentioned that I’m working on the upcoming Sams Teach Yourself Visual C# 2010 in 24 Hours book. Things are progressing nicely, if a bit slower than I’d prefer. I have the draft for the cover art, which looks really good. I’m also very pleased to announce my technical editors – Claudio Lasaala and Eric Lippert. Claudio is a Senior Developer at EPS Software Corp. He has presented several lectures at Microsoft events such as PDC and various other Microsoft seminars, as well as several ...
<< Part 2 – A quick look at IronRuby Gambling with Cucumbers In part 2 we demonstrated how we can mix .NET and Ruby though IronRuby. The question is, why would you want to do that? It is probably easier to stick with one language for most projects. Why combine them? The problem with BDD in .NET One area where Ruby currently has a clear advantage over.NET is in the realms of Behavioral Driven Development (BDD). You can write Unit Tests and Integration Tests in .NET just fine, but what about ...
<< Part 1 - Installing IronRuby and Cucumber A quick look at IronRuby Background IronRuby is an implementation of Ruby which runs on .NETs Dynamic Language Runtime platform (the DLR). Languages hosted on the DLR are interpreted at runtime, rather than compiled then executed (like C# applications). One benefit is that code can be invoked on the fly from a command line shell. This is handy when debugging or figuring out how to do something. Other popular DLR hosted languages include IronPython ...
Game development is a great career but we all can't be the next John Carmack. And let's be honest, even though you've got a great resume and a smashing portfolio, the odds are slim you'll get that coveted game programmer job. To sharpen your skills and expand your portfolio why not take a look at Microsoft's XNA Game Studio? XNA Game Studio is a library built on top of the DirectX framework to ease game development for students and hobbyists while still providing enough flexibility to create games ...
Thanks to everyone who attended my C# 4.0 New Languages Features presentation at CMAP last night. Both the code and PowerPoint are available for download. C# 4.0 New Language Features Download After the presentation, I had a few people ask me about some of tools I was using. They can all be found on my Developer Tools and Utilities page. To create my snippets, I’ve been using a tool called Snippy for years (link included on Developer Tools page). However, lately I’ve also been using Snippet Designer ...

I’ll be giving a presentation on C# 4.0 New Language Features this Tuesday at the CMAP Main Meeting.

Also I’ll be presenting MVC in the Real World this Saturday at CMAP Code Camp.

Hope to see you there!

Augusta Code Camp Nov. 7th Augusta has been kind enough to schedule me to speak at their code camp. I’ll be sharing what every C# developer needs to know about VB XML data types and in a separate session, discussing Windows Mobile development. The list of speakers includes many of “the usual suspects”, so if you can find a way to join us, you are bound to have a good time while learning lots of new things and how to do some old things better. Bill J ...
I’ve taught a number of classes recently to people who are just getting started as software developers either as a way to change careers and move into our profession or just to people who love computers and want to learn more about how to program. I personally love these types of classes as they differ so much from the standard SharePoint or Silverlight type course where the average student is fairly skilled and the questions and interaction from students is very technical. In an introduction type ...
I’m sure by now you know that the Visual Studio 2010 and .NET Framework 4 Beta has been released. If not, get it here. There are also some great training resources already available! The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4.0 Visual Basic 10 F# Parallel Extensions Windows Communication Foundation ...
I will use the AdventureWorks database to demonstrate how to perform CRUD operations using LINQ. You can use LINQPad (a free tool) to execute your C# statements without going through the hassle of writing a program using Visual Studio 2008. Launch LINQPad, add your SQL Server Connection and select AdventureWorks as the Database. Remember to select C# Statement(s) as the Language Type. Create Record 1: Department newDept = new Department()2: {3: Name = "Consulting",4: GroupName = "Consulting",5: ModifiedDate ...
The CERunApp application can be downloaded from: Download CERunApp.exe Note: in Part 3 I have included an updated version of this exe The CERunApp source code can be downloaded from: Download CERunApp source code Note: in Part 3 I have included an updated version of the source code In Windows CE: Using RAPI to Run Applications (Part 1) I wrote about starting this project to create a copy of the Windows Mobile Developer Power Toys application RAPIStart. In this article I will continue by creating ...
When passwords are set to expire after a certain number of days in Active Directory, the remote users suffer because they do not get a notification like the local users do that their password is going to expire. Eventually, it becomes too late for them to change their passwords and they get locked out. I found this out recently and did not believe that there was no built in support for this. I started researching and indeed, there was no built in support. The solution was to email the users, either ...
Adding a new row to a datatable in a specific position is a snap. The scenario in this case would be that you have a datatable filled via a stored procedure that is also used in other applications so it can not be altered. The datatable is used to populate a dropdownlist and that list needs to have the always popular ‘Select All’ option as the first item. To add this in you could use code like what is listed below after the datatable is populated from the stored procedure. The example uses two columns ...
A few months ago I downloaded the Windows Mobile Developer Power Toys (Download details: Windows Mobile Developer Power Toys) because I had a need for CERDISP, the Windows CE Remote Display tool. At that time, I looked around at the other tools that were installed and played with RAPIStart.exe. RAPIStart.exe is a command line tool that lets you start applications on your device from your workstation using ActiveSync. A handy little tool, so I made a note to try to reproduce it and write a little ...
Back Links LINQ Overview, part zero LINQ Overview, part one (Extension Methods) LINQ Overview, part two (Lambda Expressions) Note: I realize it has been a really long time since I've posted anything. It is both exciting and humbling that I continue to receive such positive feedback on these articles. In fact, that is why I am trying to put in the effort and finish off this series before moving on to more recent topics. This nomad has been on some interesting journeys these past months, and I am really ...
At the start of 2009 we worked with InnerWorkings to help over 7000 UK developers get access to free training in C# or VB. As there are at least 100,000 UK developers (depends who you ask), we decided to again partner with InnerWorkings to bring you free training in WPF, Silverlight and .NET Framework 3.5 SP1. I am a big fan of the InnerWorkings approach which embeds a set of programming challenges into the Visual Studio IDE. Maybe not for everyone but certainly is an interesting and engaging alternative. ...
Here in this series of post I am discussing few techniques to give client instant feedback on task progress in ASP.NET page. In the previous post I have discussed about displaying task progress - using regular handler, here I will discuss how to do the same in standard asp.net page. to download the source code please click here Display task progress – in standard asp.net page In this technique we write some regular ASP.NET script in the page itself, that performs streaming to the original page response ...
I was using Gzip Encoder to compress wcf message, it surprised me that sometimes the compression message size is even bigger than the original size, so I looked the code, I found within GZipMessageEncoderFactory.cs, the method "CompressBuffer" in the GZipMessageEncoderFactory class is not quite right. it was like this originally: private static ArraySegment<byte> CompressBuffer(ArraySegment... buffer, BufferManager bufferManager, int messageOffset) { .... var byteArray = new ArraySegment<byte>(bu... ...
I've just been looking over Bizmonade which is a testing tool for testing BizTalk orchestrations in isolation from the BizTalk execution environment. It's similar in concept to BizMock however the implementation is different. The simple way to describe how BizMock is implemented is that it uses a custom adapter which allows you to manipulate the messaging around an orchestration which is executing within BizTalk. Bizmonade is different in that it creates a custom version of the XLANG Engine which ...
I have been playing around with the idea of modeling business rules as a set of small workflows (Flowcharts in WF4). In the application, this would result in small workflows being called a large number of times. I decided to investigate the performance overhead of invoking a workflow in WF4, the workflow technology in .NET 4. Since I am using Visual Studio 2010 Ultimate Beta 2, this also seemed like a good opportunity to evaluate the performance profiler included in this edition of VS 2010. For this ...
I was fed up with uploading the attachments using FTP as it was too slow (and vulnerable too), maintaining credentials to connect to server, managing permissions to specific folder etc. and all that nasty stuff. Clients have also complained on this. After head-scratching and wall banging efforts, I planned to search for an alternative for FTP to upload the files. Found this way... Its pretty cool and uploading files much faster compared to FTP approach. Just wanted to share it with you, hoping that ...
The System.Net namespace contain most of the .NET base class that deal with networking from perspective of the client. The System.Net namespace is generally concerned with Higher-level operations for example download and upload files and making requests using the HTTP and other protocols. The WebClient Class If you want to do is carry out a fairly simple operation such as requesting a file from a particular URL, Then you will probably find easiest .NET class to use is System.Net.WebClient. This class ...
I was IM’ing with a co-worker recently, and both of us were working on writing Unit Tests for code we had just completed. He was saying that his car was having trouble, was in the shop, and that they really didn’t know what was wrong with it. I was going to tell him to not take any excuses from the mechanic, when the RhinoMocks IgnoreArguments()option popped into my head. I said something like “'tell him ‘FixMyCar.IgnoreArguments()’”, and it was a downward spiral of geek humor from there. Below is ...
This morning, Channel 9 launched the new Channel 9 Learning Center. From Channel 9, here’s a description of what the Learning Center is: “The Channel 9 Learning Center is the destination for free technical training on emerging Microsoft products and technologies. The Learning Center consists of a set of courses with each course including a set of videos, hands-on labs, and source code samples to get you up-to-speed quickly.” I’m pleased to say that Visual Studio 2010 is one of the first Training ...

Just going through some function programming comcepts in .Net .Don't wonder how we have this in .Net. Its there from VS2008(.Net 3.5) . I checked this blog post and its very intersting.

F# Programming Concepts and Difference with C#

Thanks,

Thani

In our team we have developers with Visual Studio 2005 and 2008. Often we have projects which must be coded by a mixed team. Visual Studio 2005 and 2008 compatibility for project-files Normally this is no problem because adding projects in Visual Studio 2005 and manually introducing the ToolsVersion="2.0" attribut in the new csproj-file allows an coexisting working when using two sln-files for Visual Studio 2005 and 2008. We name the sln-files normaly <solution>.2005.sln and <solution>.2008.sln. ...
Javascript Intellisense I read this interesting artilce when trying to enable intellisense for my Javascript file. Don miss this as its very useful. Its similar to what we do for VB or C# for intellisense i.e XML documentation. Same concept applies for JavaScript also. This will work in Visual Studio 2008 as there is an enahncement for this. Thanks, Thani ...
More Adventures in MVVM I have been taking a few weeks off from my personal studies/experiments in the .Net space to learn more about Ruby and Ruby on Rails (RoR). I have two main goals for this study: Get to know another platform as an option for future development Examine how I can incorporate different concepts into my existing framework What follows is intended to document my experimentation with the second bullet: How might we design a ViewModel if we were in Rails? My thoughts on this are still ...
Wow, this looks like a fantastic learning resource for coming up to speed with Visual Studio 2010 Beta 2. Yeah, I’m lazy and just grabbed the following text from the Visual Studio 2010 and .NET Framework 4 Training Kit page: “The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4.0 Visual Basic 10 F# Parallel ...
The Beta 2 version of DPE’s Visual Studio 2010 Training Kit is now live (you can find it at http://tinyurl.com/Beta2Tra... A training kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize a variety of Visual Studio 2010 and .NET Framework 4 technologies. The Beta 2 release of the Training Kit contains 15 presentations, 19 hands-on labs, and 13 demos. Many technologies are covered in this release, including: C# 4, VB 10, F#, Parallel Extensions, ...
It’s been a while since I’ve blogged since things have been crazy busy. I finally decided to kick myself and do a post so without further ado, the problem at hand: A co-worker of mine asked me whether its possible to dynamically create a type from some data he is receiving from a WCF service (over HTTP). My natural response was, why would you need to do that since Visual Studio creates a proxy from the metadata exposed by the service and the return types would typically be DataContracts. Well, it ...
I recently needed to un-gzip (gUnzip?) a large amount of files programatically and eventually ended up with the class/library posted below. With the GZipStream (.NET / dot net), I had seen a lot of examples compressing and decompressing strings in memory, but I needed the straight-forward, simple method of just compressing and inflating/decompressing a file (in the simplest manner). I made the buffer size modifiable to allow you to customize the amount of RAM needed for the process. In all of this, ...
When trying to generate an ASP.NET proxy class from a physical wsdl on your local file system, you're probably doing something like this: wsdl.exe MySevice.wsdl /o:Proxy.cs /l:CS You'd expect a file named Proxy.cs to get created in C# for you. You'd be right, except if you're attempting to generate proxy for a service that uses complex types. If that is the case, you'll get an error that looks a lot like this: Error: Unable to import binding 'MyBinding' from namespace 'http://www.example.org/MyN... ...
UPDATE: Please see first comment to do this the "safe" way... It took a bit for me to get comfortable enough with LINQ-to-objects to write ‘queries’ off the top of my head…but once you’re used to it you realize it’s much more concise, easier to interpret/read, and well..it’s less code. Here are some real quick examples… This first example selects the string array value as well as its position from the someItems array. Note, the user of new{} creates a new generic type that has the properties ItemName ...
Recently I had the need to implement support for Dynamic Linq queries in my framework project. For the uninitiated, Dynamic Linq allows me to write statements like this: var query = db.Customers.Where("City == @0 and Orders.Count >= @1", "London", 10). OrderBy("CompanyName"). Select("New(CompanyName as Name, Phone)"); where I can specify the predicates and selectors as string values. Microsoft has published a helper class that enables DynamicLinq support here -->C# Dynamic Query Library (included ...
This example shows how to move multiple rows between GridViews. The main idea here is to use a CheckBox control for selecting the rows to be removed from one GridView to another and vise versa. Take a look at sample screen shots below: On initial load: Selecting rows from the left GridView: After Moving the selected rows to the right GridView: As you notice the selected rows are automatically sorted by its ID upon moving. Selecting rows from the Right GridView: After Moving the selected rows to the ...
I recently had the need to set the output path of the log files at runtime in log4net. For some reason up until now I had never attempted to accomplish this. As corporate permissions are more and more restrictive I found the need to set the FileAppender.File path at runtime to a location within the users profile. It turns out accomplishing this task is quite simple. public static void Initialize(string logDirectory) { //get the current logging repository for this application ILoggerRepository repository ...