Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Coding   (RSS)

A million-dollar pen vs. a pencil

You know this legend about how NASA spent millions to develop a pen that can write in zero gravity , and the russians have just used a pencil? Well, I was reminded about this by Dejan ’s post in response to my post about the Random Gradient Wallpaper
Posted by Kirill Osenkov | 5 Comments
Filed under: ,

Bezier Curves and Car Manufacturers

Michael has asked me if it was possible to add Bezier curves to Live Geometry. So I went ahead and added a Bezier tool (and it took me about 30 minutes to do so!): This draws a cubic Bezier curve using four points: There is something beautiful and elegant

Irony

(Ironically, this post is not about irony in it's traditional sense ) Irony ( http://irony.codeplex.com ) is an open-source .NET compiler construction framework written by Roman Ivantsov . It is a ".NET Language Implementation Toolkit". The
Posted by Kirill Osenkov | 4 Comments
Filed under: ,

Saving images (.bmp, .png, etc) in WPF/Silverlight

I’ve recently added a new feature to Live Geometry that allows users to save the current drawing as a bitmap or a .png file. Just push the save button and pick the desired image format in the Save dialog: Fortunately, both WPF and Silverlight support

Random Gradient Wallpaper Generator

Oops, I did it again :) Created a new CodePlex project, that is. Introducing http://wallpaper.codeplex.com – a simple tool to generate a nice random wallpaper and display it on your desktop with just one click: Randomize - assigns random colors to all
Posted by Kirill Osenkov | 8 Comments
Filed under:

Dump Environment Folder Paths

This is just a quick snippet to dump the value of Environment.GetFolderPath for all special folders on a machine (so I don’t have to write it again next time): public static string DumpEnvironmentPaths() { var paths = Enum .GetValues( typeof ( Environment
Posted by Kirill Osenkov | 7 Comments
Filed under: ,

Reflection with dynamic

This past summer the Visual C# IDE team was fortunate enough to have Paul van Brenk intern with us. Paul is a great guy and an experienced .NET developer from Rotterdam, Netherlands , who is interested in Azure, cloud computing and many other things.
Posted by Kirill Osenkov | 0 Comments
Filed under: , , ,

UI without code or XAML: PropertyGrid, DataForm, etc.

WPF has certainly advanced the state-of-the-art in programming the UI. I personally think that WPF and Silverlight remove all the limits that existed to UI development in the past. The only limit now is your imagination. XAML is there for declarative

Calling new on an interface

Interesting thing: technically there is a way to call new on an interface to create an object. How? Using a feature in the C# compiler for COM-interop support: using System.Runtime.InteropServices; class Program { static void Main( string [] args) { IFoo
Posted by Kirill Osenkov | 10 Comments
Filed under: ,

Instantiating types with no public constructors

It turns out, Activator.CreateInstance and Activator.CreateInstance<T> fail if there is no public parameterless constructor defined on a type we’re trying to instantiate. Even if the constructor is internal (basically, anything other than public),
Posted by Kirill Osenkov | 6 Comments
Filed under:

Samples for the Undo Framework

I just added some samples for the Undo Framework . You can find the samples in the source code or download them from the project website. MinimalSample First is a simple Console App sample called MinimalSample. Here’s the full source code: using System;
Posted by Kirill Osenkov | 6 Comments
Filed under: ,

Algorithms in C#: shortest path around a polygon (polyline routing)

Suppose you have to build a road to connect two cities on different sides of a lake. How would you plan the road to make it as short as possible? To simplify the problem statement, a lake is sufficiently well modeled by a polygon, and the cities are just

yield return and Continuation-Passing Style

Someone was recently porting some C# code to VB and had a question about how to convert the C# yield return iterator methods to VB (VB currently doesn’t support iterators). There were a lot of replies like “use Reflector on a compiled binary and copy-paste
Posted by Kirill Osenkov | 5 Comments
Filed under: ,

A simple sample for C# 4.0 ‘dynamic’ feature

Earlier I posted some code to start Visual Studio using C# 3.0: using System; using EnvDTE; class Program { static void Main( string [] args) { Type visualStudioType = Type .GetTypeFromProgID( "VisualStudio.DTE.9.0" ); DTE dte = Activator .CreateInstance(visualStudioType)
Posted by Kirill Osenkov | 11 Comments
Filed under: , ,

Kirill’s Whitespace Guidelines for C#

I don’t remember seeing any explicit guidelines on whitespace formatting for C# programs, however it seems that experienced C# developers all format their C# code files in a very similar fashion, as if there are some implicit but widely-accepted rules.
Posted by Kirill Osenkov | 16 Comments
Filed under:
More Posts Next page »
 
Page view tracker