c# covariant return types utilizing generics First off, the answer to your question is no, C# does not support any form of return type covariance on virtual overrides. A number of answerers and commenters have said "there is no covariance in this question". This is incorrect; the original poster was entirely correct to pose the question as they did. Recall that a covariant mapping is a mapping which preserves the existence and direction of some other relation. For example, the mapping from a type T to a type IEnumerable<T> is covariant because it preserves the assignment compatibility relation. c# covariant return types utilizing generics
Write Mobile Agents In .NET To Roam And Interact On Your Network Wandering Code Write Mobile Agents In .NET To Roam And Interact On Your Network Matt Neely Code download available at:MobileAgents.exe(145 KB) Write Mobile Agents In .NET To Roam And Interact On Your Network
Output an Assembly Version/Fully Qualified Name from the CommandLine
Why? Recently, I started seeing numerous requests regarding creation of custom permissions that do not inherit from CodeAccessPermission and thus do not perform stackwalk. There is nothing special about implementing such classes. In fact, it is easier then with CodeAccessPermission as a base. Sample of non-CAS custom permission with declarative form supported. - Eugene Bobukh's WebLog Sample of non-CAS custom permission with declarative form supported. - Eugene Bobukh's WebLog
In this series of Demystifying C# 3.0 we have already covered - a) Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var"b) Demystifying C# 3.0 - Part 2: Anonymous Typesc) Demystifying C# 3.0 - Part 3: Extension Methodsd) Demystifying C# 3.0 - Part 4: Lambda Expressionse) Demystifying C# 3.0 - Part 5: Object and Collection Initializersf) Demystifying C# 3.0 - Part 6: (LINQ) Query Expression Translation (to C# 3.0) Thank you to both Eric Wise, and C. Steen for linking. The more people we have look at these posts, the better the overall discussion quality will be. Okay, so next we will be talking about "Expression Trees". Demystifying C# 3.0 - Part 7: Expression Trees Demystifying C# 3.0 - Part 7: Expression Trees
In this series of Demystifying C# 3.0 we have already covered - a) Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var"b) Demystifying C# 3.0 - Part 2: Anonymous Typesc) Demystifying C# 3.0 - Part 3: Extension Methodsd) Demystifying C# 3.0 - Part 4: Lambda Expressionse) Demystifying C# 3.0 - Part 5: Object and Collection Initializers I *strongly* recommend reading up the above in sequence before reading this post. This is, (I feel) a rather good post, that will set LINQ in your mind clearly. If you rush through this post, you will waste this opportunity. Demystifying C# 3.0 - Part 6: (LINQ) Query Expression Translation (to C# 3.0) Demystifying C# 3.0 - Part 6: (LINQ) Query Expression Translation (to C# 3.0)
Demystifying C# 3.0 - Part 4: Lambda Expressions Demystifying C# 3.0 - Part 4: Lambda Expressions In the Demystifying C# 3.0, I've already talked about - a) Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var"b) Demystifying C# 3.0 - Part 2: Anonymous Typesc) Demystifying C# 3.0 - Part 3: Extension Methods Lets next talk about Lambda Expressions. The best way I can describe Lambda Expressions are - C# Anonymous Methods, only a lot cooler. So what is an anonymous method in C# 2.0? Well y'know you can write code like below in C# 1.x/2.x -
Demystifying C# 3.0 - Part 3: Extension Methods Demystifying C# 3.0 - Part 3: Extension Methods If you've been following my blog, you would have noticed that I've been trying to talk about new C# 3.0 features one by one. I am trying to take the technical jargon out, and bring these features down to an understandable level. You may want to read the two features I have already talked about below - a) Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var"b) Demystifying C# 3.0 - Part 2: Anonymous Types
In my last blog entry, I had talked about Implicitly typed local variables and the "var" keyword. If you have stumbled across this post through a search engine, or otherwise, I would recommend reading that first. Assuming that you understand "var" - lets dive into part 2 of Demystifying C#3.0 ~ Anonymous Types. Demystifying C# 3.0 - Part 2: Anonymous Types Demystifying C# 3.0 - Part 2: Anonymous Types
I am going to publish a series of blogposts that intend to bring C# 3.0 down to earth. C# 3.0, along with LINQ, and all the heavy duty talk that surrounds it has sort of made it difficult to understand IMO. Well - if not difficult to understand, it sure is tough to gauge - "Where to begin". So with 5 minutes a day, a short post a day will dice and slice a single feature, and we will logically move to a fuller picture of C# 3.0, followed by LINQ, and DLINQ (if I still have steam left). Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var" Demystifying C# 3.0 - Part 1: Implicitly Typed Local Variables "var"
Cutting Edge: Customize Your Open File Dialog Cutting Edge: Customize Your Open File Dialog Cutting Edge Customize Your Open File Dialog Dino Esposito Code download available at:CuttingEdge0303.exe(96 KB) Displaying an Open File dialog is certainly easy in the Microsoft® .NET Framework with Windows® Forms, but the resulting window is not as customizable as when you create it through the Win32® API. With Windows 2000, Microsoft added a nice feature—the places bar, which is the vertical toolbar that appears on the left side of the window to let you select a frequently visited folder.
There are other situations in which a custom permission might be appropriate. When a built-in code access permission class protects a resource but does not sufficiently control access to that resource, you might need a custom code access permission. For example, an application might use personnel records for which each employee record is stored in a separate file; in such a case, read and write access could be controlled independently for different types of employee data. An internal management tool could be authorized to read certain sections of an employee's personnel file but not to modify those sections. In fact, it might not even be allowed to read some sections. Wherever possible, permissions should not overlap. Creating Your Own Code Access Permissions
Class Data Binding using Custom Attributes Download source files - 1.73 KB Introduction At the end of this article, you should be comfortable using Custom Attributes. This article focuses on using them in order to create a quick, flexible data binding mechanism.
Why are NameValueCollection lookups slower than Hashtable? [Kim Hamilton] - BCL Team Blog An internal discussion came up recently on the performance difference of lookups in Hashtable versus NameValueCollection. Benchmarks revealed that NVC lookups were ~2-8 times slower than Hashtable. For example, when doing 40,000 lookups on a collection size of 100,000, NameValueCollection is about 2.6x worse:
.NET Matters: ICustomTypeDescriptor, Part 1 .NET Matters ICustomTypeDescriptor, Part 1 Stephen Toub Code download available at:NETMatters0504.exe(163 KB) Q I write a lot of one-off utilities for personal use, and since they don't require any sophisticated user interfaces, I often use a System.Windows.Forms.PropertyGrid bound to a settings class in order to allow the user to configure a tool's operations. Unfortunately, sometimes I don't write these settings classes, and often they've been constructed in a way that's incompatible with the PropertyGrid.
Download demo project and source - 296 Kb The code download has been updated for the final release of the Enterprise Library, including design support for the EntLibConfig application. Introduction A group of programmers, far smarter than I, have been laboring from some time to create a library of utilities to help developers like myself to create better applications. An MSN Messenger Log Listener
Avoiding configuration pitfalls with incompatible copies of Enterprise Library - Tom Hollander's blog
Parallel Performance: Optimize Managed Code For Multi-Core Machines
Design: Task Parallel Library explored - MSDN Utopia
Enable/Disable Network Connection - David Aiken
Large Data and Streaming
Using Custom Filters in the Enterprise Library Logging Block
Script#
gemrcsharpcs.pdf (application/pdf Object)
The most complete C# Webbrowser wrapper control
c# - How can I get a value of a property from an anonymous type
flag enum confusion C#
Menus, part III : animated multi-level drop-down menu
Continuation-Passing Style Simplifies Your C# Exception Handling Code « Paint.NET Blog
Exploring Lambda Expression in C#
HTTP Communication and Security with Silverlight
.NET Matters: Abortable Thread Pool
Coding Best Practices Using DateTime in the .NET Framework
Popup Window Finder and Mouse Tracker in C#
Low-Level Mouse Hook in C# - Stephen Toub
Blog Archive » DynamicObject in C# 4.0
Pattern Matching in C# - Part 1