Google Considered C# as the Native Language for Android

3 Comments »

Wow, I nearly fell out of my chair when I read this little gem on TechCrunch:

Android chief Andy Rubin wrote in a 2005 email, “If Sun doesn’t want to work with us, we have two options: 1) Abandon our work and adopt MSFT CLR VM and C# language – or – 2) Do Java anyway and defend our decision, perhaps making enemies along the way.”

Imagine how different the world would be today if Google had chosen .NET instead of Java as the native development framework for the Android mobile operating system…

Read more at DevTopics >>

C# Custom Enumerators Made Simple with the Yield Keyword

2 Comments »

An enumerator enables you to iterate over a collection in a foreach loop.  You can use foreach to iterate over all C# collection classes, because all C# collection classes inherit from the IEnumerable interface (regular or generic).  IEnumerable contains the GetEnumerator method, which returns an enumerator.

Occasionally you may find a need to create a custom enumerator, which used to be somewhat of a challenge until the yield keyword was introduced.  Here is how Microsoft describes yield:

The yield keyword signals to the compiler that the method in which it appears is an iterator block.  The compiler generates a class to implement the behavior that is expressed in the iterator block.  In the iterator block, the yield keyword is used together with the return keyword to provide a value to the enumerator object.  This is the value that is returned, for example, in each loop of a foreach statement.

So rather than creating your own enumerator class and managing the enumeration state — which is time consuming and tricky — you can simply write the enumeration logic in the GetEnumerator method, and the yield keyword will automagically wrap your code in a handy-dandy enumerator.

Read the rest of this entry »

.NET Isn’t Dead

1 Comment »

I jump into the controversy about the future of the .NET Framework and HTML5+JavaScript.

Read “.NET Isn’t Dead” on DevTopics.com >>

Apparently C# Doesn’t Suck

2 Comments »

YourLanguageSucks is a wiki on theory.org that lists reasons why the most popular programming languages suck.  There are long lists of reasons why Java, JavaScript, C++ and PHP suck.  But the list for C# is very short:

  • Supports ‘goto’.
  • Two distinct sets of collections: non-generic and generic.  Stack and Queue have the same name in both their generic and non-generic flavors, but then we have Hashtable (non-generic) and Dictionary (generic).

The first reason is easy to discount: just avoid using goto!  The second reason is valid, but not really an issue if you use only generic collections, as I do.

Read the rest on DevTopics >>

Microsoft.CSharp.targets was not found

1 Comment »

If you receive the following Visual Studio compiler error:

Error MSB4019: The imported project "C:Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Read the rest of this entry »

Ultimate List of Freely Available .NET Libraries

No Comments »

Qink has assembled a comprehensive list of freely-available libraries for the Microsoft .NET platform.

Free .NET Libraries

Visual Studio 2010 Service Pack 1

No Comments »

Microsoft Visual Studio. Copyright © Microsoft Corp.

Microsoft has released Service Pack 1 for its Visual Studio 2010 flagship integrated development environment (IDE).  Visual Studio SP1 provides many new features, performance improvements, and bug fixes including:

  • Stand-alone Help Viewer 1.1
  • Silverlight 4 support
  • Basic Unit Testing support for .NET 3.5
  • .NET Framework 4 improvements
  • Performance Wizard for Silverlight
  • Visual Basic Runtime embedding
  • IntelliTrace for 64-bit and SharePoint
  • Fix for partial or mixed Visual Studio installations
  • IIS 7.5 Express support
  • SQL Server CE 4 support
  • Razor support for ASP.NET Web Pages and MVC 3
  • Web Platform Installer integration
  • HTML5 and CSS3 preliminary support
  • WCF RIA Services localized and supported
  • XAML Editor/Designer improvements
  • XAML Style IntelliSense
  • C++ MFC-based GPU-accelerated graphics and animations
  • New AMD and Intel instruction set support

Download Visual Studio 2010 SP1
Full Description of VS 2010 SP1
Tips on Installing VS 2010 SP1

C# Internal Interface

5 Comments »

When building a C# interface, you may find a need for both public and internal methods, such as:

public class MyClass : IMyInterface
{
    public void MyPublicMethod() { }
    internal void MyInternalMethod() { }
}
public interface IMyInterface
{
    public void MyPublicMethod();
    internal void MyInternalMethod();
}

Read the rest of this entry »

Where is PaddingF? And Other Padding Oddities

1 Comment »

There is No PaddingF

There is Point and PointF, Size and SizeF, Rectangle and RectangleF, Padding and… wait, there is no PaddingF!

System.Drawing vs. System.Windows.Forms

The 2-D drawing functions in the System.Drawing namespace accept both integer and floating point measurements.  That’s why the main 2-D drawing structures have both int and float versions such as Point and PointF, respectively.

However, the Padding structure is defined separately in the System.Windows.Forms namespace where most 2-D measurements are in integers.  Hence, there is an integer Padding structure but no floating point PaddingF.

Read the rest of this entry »

Visual Studio Productivity Power Tools Update

No Comments »

Visual Studio Productivity Power Tools.  Copyright © Microsoft Corp.

Microsoft has updated the free Productivity Power Tools for Visual Studio 2010.  These are add-ins that provide very useful additional functionality for Visual Studio.  New in this release:

  • No More Extension Resets – This version of the Productivity Power Tools will be the last which resets the extensions.
  • Find – Quick find & incremental search now pops up at top right-hand corner of the editor.
  • Enhanced Scrollbar – Icons overlay the scrollbar to show edits, breakpoints, bookmarks, errors, warnings, etc.
  • Middle-Click Scrolling – Use your scroll wheel to quickly scroll through your document.
  • Organize Imports for Visual Basic – Sort the imports logically and remove the ones that aren’t being used.

Productivity Power Tools for Visual Studio 2010

See more .NET News like this!

keep looking »