DCSIMG
.Net Framework - IronShay

Browse by Tags

All Tags » .Net Framework (RSS)

Slides and Code Samples from my Talk at LIDNUG - What?!? C# Could Do That???

On Thursday I had the honor to do a virtual talk at LIDNUG – the LinkedIn .NET User Group. A stage where lots of .NET celebs like Scott Gu, Jeffery Richter, Jeff Prosise and others have talked in the past. I’d like to thank all the attendees and the LIDNUG crew who made this possible – Inbar, Peter and Brian – you guys rock! About the talk – I focused on the dynamic capabilities of C#. Started with some black magic done using the dynamic keyword, then moved on to practice witchcraft with the combination...

LINQ Tip: Chain Ordering

Assuming you have the next code: public class Person { public string Name { get; set; } public int Age { get; set; } } public class Whatever { public void Do() { var people = new List<Person> { new Person {Name = "Shay Friedman", Age = 27}, new Person {Name = "Shawn Doe", Age = 51}, new Person {Name = "Elvis Presley", Age = 76} }; } } And now you want to order it first by name and then by age using LINQ. If you were to do that: var orderedPeople = people.OrderBy...
Posted by shayf | with no comments

Visual Studio - Past to Present

[Cross-posted from http://www.ironshay.com/post/Visual-Studio-Past-to-Present.aspx ] Recently I‘ve been working at a client site where they are using Visual Studio 2005 for their main project. I’ve gotta say that I was a bit surprised since I haven’t come across VS2005 for a few years… I immediately became nostalgic and decided to share. So I’m proud to present (with help from Wikipedia and the WWW), Visual Studio – from past to present! The Big Visual Studio Usage Poll Before we begin, I wanna find...

It’s not a Baby Boom, It’s a Microsoft Product Boom!

The last few months were a bit hectic if you stayed tuned to announcements coming from Microsoft regarding new products. It honestly looks like some folks down in Redmond haven’t seen home for a while. Even though I don’t agree with the need for some of these new products, I think it’s a great thing that the .NET Framework is becoming even bigger than it used to be and we, as a result, get more options. Good! So what’s new? May – IIS Developer Express This is a web server that’s aimed to reduce the...
Posted by shayf | 1 comment(s)

IronRuby and IronPython on the next Israeli .NET User Group Meeting

August is going to be a very busy month for me, speaking at DevLink , TechEd Japan and RubyKaigi . In addition, with the help of Dror Helper , we’re bringing dynamic languages to the local .NET crowd in Israel! When? August 18th, 17:30-20:30. Where? The Israeli .NET User Group (IDNUG) August meeting, Microsoft offices, Dekel room HaPnina 2, floor 0 Raanana, ISRAEL What? 17:30 - 18:00   Assembly 18:00 - 19:15   “Introduction to IronRuby”                           ...

ALT.NET Tool Night

The Israeli ALT.NET community is having a tool night! The idea is simple – 5-6 speakers will have around 20 minutes each to tell you about a handy tool that is worth to be added to your development toolbox. Time Monday, July 12th. 18:00-21:00. Location Sears offices, Ekershtein building A, HaMenofim 9 St., Herzeliyya Pituach See in Google Maps Agenda Test Lint – Roy Osherove Code Rush & Resharper  - Uri Lavy Process Explorer – Ariel Raunstien NDepend – Dror Helper IronRuby – Shay Friedman...

Use .NET Built-in Methods to Save Time and Headaches

During our everyday programming tasks we run into several repetitive code blocks that after the 20th time you implement them become really annoying. The worst case is to re-implement these code blocks every time, and the better case is to create a central class library with helper classes and methods. However, a large amount of these tasks can be achieved easily with built-in .NET methods. In this post I will go through several repetitive code blocks and show you how to implement them using built...
Posted by shayf | 4 comment(s)
תגים:, ,

Is String.IsNullOrEmpty Good or Bad?

I started to wonder about that when I was looking for an equivalent method in Ruby. Apparently, Ruby doesn’t come with such a method built-in, but you can add it very easily by using Ruyb’s monkey patching abilities. This is odd, because Ruby is the greatest language and has everything you possibly need (and IronRuby is even better! :) ). So why isn’t there an IsNullOrEmpty-like method? Well, they might just didn’t think it was important enough. And there might be a different answer, maybe the decision...
Posted by shayf | with no comments

I'm Proud to Present - IronRuby Unleashed

Hi readers! I'll start with the announcement - I'm writing a book! it is called "IronRuby Unleashed" and it will be published by Sams Publishing who has brought the world the great Unleashed series. What is the Book About? Well, I bet you've guessed it already - the book is about IronRuby. With version 1.0 right around the corner, it is more than important to have some reference books so developers can get started in no time. The book is a ~500 page reference and guide book...
Posted by shayf | 4 comment(s)

IDCC Session Voting is Open!

If you haven't heard yet, IDCC session voting is now open! Go and place your votes: http://idcc.co.il/sessions If yo're intersted in hearing about IronRuby or IronRuby on Rails , vote for my sessions: IronRuby - The Development Booster Machine IronRuby V1.0 is just around the corner and it's a great time to get your hands dirty! In this session you will get familiar with the main concepts of IronRuby and see how this exciting new .Net language will help you boost your everyday work. From...

A Handy Extension Method: Retrieving Session Variables

[More handy extension methods: raise events safely , get the current page load mode ] Retrieving session variables is a daily task for web developers. In order to fetch a session variable, we should check if it exists and only then convert it to the expected type and use it. For example: int myVal; if (Session[ "MyVar" ] != null ) { int .TryParse(Session[ "MyVar" ], out myVal); } // ... more code ... This is an annoying practice which can be easily replaced by extension methods...

A Handy Extension Method: Raise Events Safely

Raising events is a very common practice. We do that a lot and it’s pretty irritating to check for nullity every time: if (eventHandler != null ) { eventHandler(sender, e); } Here comes extensions methods to our aid again. With only two extension methods, we can cover all possible event handlers and raise our events safely in one line. For example: MyEvent.RaiseSafe( this , EventArgs .Empty); Or MyEvent.RaiseSafe<MyEventArgs>( this , new MyEventArgs(someParameter)); In order to achieve that...

C# Tip: Converting Whole Lists in a Single Line of Code

Lately I wanted to convert a list of items from one type to another. There is the straight way of doing so: writing a loop that iterates through the list, converts each item and generates the output list. There is a shorter way though. List has a ConvertAll method. You give it the output type and a delegate that converts a single item and that’s it. Writing this delegate yourself is just annoying… This is where the Convert class comes into action – you can use the Convert.ToXXX as the conversion...
Posted by shayf | 3 comment(s)

Make Your Application Extendable Using the DLR

It’s very common for applications to have a way to extend them. Extensibility comes in various ways and have multiple names too – plug-ins, add-ins, addons, etc. It seems, though, that one kind of extensibility was left to the very few – application macros. The concept is very simple – You don’t need to create a special Dll, implement a specific interface and register it somehow, you don’t even have to install an IDE. All you have to do is to open the relevant window, write some code and voila –...

.Net Tip: Console.Out

Shabat Shalom everyone! The Problem Sometimes you want your output to get written to the console and all you have is a method that receives a stream to output to. For example, DataSet.WriteXml gets different types of streams or a file path to write to... The Solution If you want to output the result to the screen, use Console.Out as your stream: DataSet d = GetDataSetFromSomewhere(); d.WriteXml( Console .Out); That's it! All the best, Shay.
Posted by shayf | with no comments
More Posts Next page »