DotNetShoutout - Stories tagged with Extension Methods
2
Shouts

Inside C# Extension Methods « Sankarsan’s Journal

posted by http://sankarsan.myopenid.com/http://sankarsan.myopenid.com/ 578 days, 15 hours, 38 minutes ago
Monday, October 24, 2011 2:23:52 AM GMT
C# Extension methods were introduced in C# 3.0. They provide a mechanism to extend(not the inheritance way) the functionality of an existing class by attaching methods to it.An extension method needs to be developed in a static class as a static method as shown below: public static class MyExtensions { public static Int32 AddExt(this Int32 i, Int32 j) { return i + j; } } We can invoke it as 10.AddExt(12) In this post we will look at what’s happening inside... (more)
category: How To | clicked: 8 | comment | | source: sankarsan.wordpress.com
tags: Extension Methods, C#
5
Shouts

Extension method digest #5 DateTime.FromNow

published 724 days, 6 hours, 17 minutes ago posted by ChadMoranChadMoran 727 days, 2 hours, 50 minutes ago
Tuesday, May 31, 2011 11:45:38 AM GMT Saturday, May 28, 2011 3:12:37 PM GMT
Quick little extension method I use quite often when trying to get the relative difference between a given time and, well now. (more)
category: Architecture | clicked: 27 | comment | | source: www.chadmoran.com
tags: Extension Methods, C#
6
Shouts

Creating an English-like Math DSL

published 730 days, 10 hours, 19 minutes ago posted by KodefuGuruKodefuGuru 732 days, 14 hours, 45 minutes ago
Wednesday, May 25, 2011 7:43:28 AM GMT Monday, May 23, 2011 3:17:10 AM GMT
The answer to life, the universe, and everything is well-known as 42. There are a myriad of questions that lead to this answer, and my favorite is perhaps the percent of leet pi. I wanted to be able to write this in C# as close to English as possible. Since I had no way to write my own keywords, the closest I could devise was the following bit of code.double percent = 0.01; var answer = percent.Of().Leet().Pi(); The tricky part here is deciding what to do about the Of() method. It represents an operati... (more)
category: How To | clicked: 0 | comment | | source: www.kodefuguru.com
tags: Extension Methods, functional, partial application
6
Shouts

Declarative Refactoring in C#

published 740 days, 13 hours, 33 minutes ago posted by KodefuGuruKodefuGuru 742 days, 19 hours, 42 minutes ago
Sunday, May 15, 2011 4:29:37 AM GMT Thursday, May 12, 2011 10:20:11 PM GMT
You will learn how to fully utilize the C# language to assign functionality where it belongs, make your code readable even for that future you, and in the process end up with a reusable framework. (more)
category: Screencast | clicked: 5 | comment | | source: channel9.msdn.com
tags: Extension Methods, Refactoring, C#, Declarative, continuations
7
Shouts

Comparing MVC 3 Helpers: Using Extension Methods and Declarative Razor @helper Syntax - Jon Galloway

published 787 days, 3 hours, 9 minutes ago posted by iftekharahmedamitiftekharahmedamit 789 days, 6 hours, 31 minutes ago
Tuesday, March 29, 2011 2:53:38 PM GMT Sunday, March 27, 2011 11:31:08 AM GMT
HTML Helpers provide a clean way to encapsulate view code so you can keep your views simple and markup focused. There are lots of built in HTML Helpers in the System.Web.Mvc.HtmlHelper class, but one of the best features is that you can easily create your own helpers. While you've been able to create your own helpers since MVC 1 using extension methods, the Razor view engine gives you a new option to create helpers usi... (more)
category: Web Dev | clicked: 12 | 1 comment | | source: weblogs.asp.net
tags: ASP.NET MVC 3, ASP.NET MVC, Extension Methods, Razor Syntax, MVC 3, Helpers, MVC, ASP.NET
7
Shouts

A Smarter Entity Framework Include Method

published 815 days, 5 hours, 9 minutes ago posted by http://managedfusion.com/http://managedfusion.com/ 816 days, 21 hours, 58 minutes ago
Tuesday, March 01, 2011 12:53:37 PM GMT Sunday, February 27, 2011 8:04:44 PM GMT
A Smarter Entity Framework Include Method No CommentsProgramming One of the things I have always disliked about Entity Framework and their support for LINQ is that while your whole LINQ statement is compile time checked to make sure you didn’t fat finger any SQL statement, the Include() statement is not.  How many times has something like this happened to you?var account1001 = (new AccountEntities()) .Accounts.Include("Userx") .Where(account => account.Id == 1001) .SingleO... (more)
category: Data | clicked: 4 | comment | | source: coderjournal.com
tags: Extension Methods, Entity Framework, Expression
3
Shouts

DateTime formatting extension method - Context is King

published 933 days, 22 hours, 24 minutes ago posted by thangchungthangchung 935 days, 6 hours, 18 minutes ago
Tuesday, November 02, 2010 7:38:27 PM GMT Monday, November 01, 2010 11:44:28 AM GMT
Notes: I also updated the pieces of code at http://www.extensionmethod.net/Details.aspx?ID=393 In current project, I get some troubles in DateTime class, about format the date time object with the pattern specific string and the current culture, so I decide to code some extension methods in DataTime class in .NET library. And I think it’s it very useful if somebody can use it as right way. I take some idea from this link and coding the enum class for its. After that I also used the Lambda Expression for... (more)
category: Web Dev | clicked: 0 | comment | | source: weblogs.asp.net
tags: enum, .NET, Extension Methods
4
Shouts

A More Fluent API For AutoMapper

posted by Matt_TCFMatt_TCF 962 days, 16 hours, 35 minutes ago
Tuesday, October 05, 2010 1:27:30 AM GMT
I love AutoMapper. I’ve used it in virtually every ASP.NET MVC application I’ve ever worked on. It has saved me countless lines of tedious code, and it’s quite smart at inferring the correct mappings. However, my one complaint is that the API for specifying the more complicated mappings is, in a word, ugly. It’s flexible, sure, but ugly. In this post, I’ll show you how a few simple extension methods that can make things much prettier. (more)
category: Web Dev | clicked: 10 | comment | | source: trycatchfail.com
tags: ASP.NET MVC, Extension Methods, AutoMapper
3
Shouts

Jef Claes: Extension method: DateTime.IsInFuture()

published 1005 days, 5 hours, 3 minutes ago posted by http://jclaes.blogspot.com/http://jclaes.blogspot.com/ 1006 days, 6 hours, 51 minutes ago
Monday, August 23, 2010 12:59:06 PM GMT Sunday, August 22, 2010 11:10:56 AM GMT
In this post you can find a simple DateTime extension method. The IsInFuture method simply returns a boolean indicating whether the DateTime instance is in the future or not.. (more)
category: Architecture | clicked: 0 | 1 comment | | source: jclaes.blogspot.com
tags: Extension Methods, DateTime, CodeSnippet, C#, extension method
5
Shouts

The collection of extension methods in C# : The CodeGain

published 1011 days, 1 hour, 41 minutes ago posted by codegaincodegain 1012 days, 11 hours, 57 minutes ago
Tuesday, August 17, 2010 4:21:41 PM GMT Monday, August 16, 2010 6:05:25 AM GMT
In this codesnippet, you can see examples for extension methods in C# (more)
category: How To | clicked: 0 | comment | | source: www.codegain.com
tags: .NET, Extension Methods, C#, C# 4.0, C# 3.0
5
Shouts

Summation Functions

published 1031 days, 4 hours, 57 minutes ago posted by KodefuGuruKodefuGuru 1032 days, 5 hours, 2 minutes ago
Wednesday, July 28, 2010 1:05:43 PM GMT Tuesday, July 27, 2010 12:59:46 PM GMT
Creating a summation function in C# isn’t difficult in itself. After all, it is perfectly reasonable to create functions that consist of more than one line. What is interesting is abstracting it so that any function can become a summation function. (more)
category: How To | clicked: 2 | comment | | source: www.kodefuguru.com
tags: Extension Methods, VB, C#, query expressions, Func
9
Shouts

How to add method in Sealed class - Imran's Blog

posted by jacobsebastianjacobsebastian 1033 days, 10 hours, 42 minutes ago
Monday, July 26, 2010 7:19:55 AM GMT
This post explains how to add a method to a Sealed Class using Extension Methods (more)
category: Web Dev | clicked: 0 | comment | | source: beyondrelational.com
tags: Extension Methods, dotnet, Sealed Class, C#, C#.NET, C# 3.0
5
Shouts

Maybe as an Extension Method

published 1055 days, 3 hours, 26 minutes ago posted by KodefuGuruKodefuGuru 1058 days, 3 hours, 56 minutes ago
Sunday, July 04, 2010 2:36:02 PM GMT Thursday, July 01, 2010 2:06:40 PM GMT
A frequent question I received concerning the Maybe static class was “why didn’t you make extension methods?” I am a proponent of extension methods, so it would seem that I would prefer “42”.ToInt32() over Maybe.ToInt32(“42”). However, I immediately created a static class for this despite my previous criticisms of helper classes. Why? Semantics What does it mean when someone writes Request.QueryString[“index”].ToInt32()? It’s not obvious that ToInt32() returns a Nullable (more)
category: How To | clicked: 0 | comment | | source: www.kodefuguru.com
tags: Extension Methods, Convert, String, extension method, Parsing
3
Shouts

DataGridView Export to Excel

published 1084 days, 6 hours, 19 minutes ago posted by KodefuGuruKodefuGuru 1085 days, 21 hours, 38 minutes ago
Saturday, June 05, 2010 11:43:25 AM GMT Thursday, June 03, 2010 8:23:57 PM GMT
I’m still in the middle of converting a few tools, and the latest is a Visual Studio package I created. This package allows our developers to edit decision tables in a grid rather than XML, and one of the features requested was the ability to export to Excel. Since the editor was implemented with a DataGridView, I decided it would be nice if the DataGridView could export its own information to excel. Our project used a simple grid layout, so you may need to make modifications if you’re planning on using ... (more)
category: How To | clicked: 7 | comment | | source: www.kodefuguru.com
tags: Extension Methods, dynamic, Office Automation, Excel, DataGridView
7
Shouts

Responsible Extension Methods

published 1100 days, 6 hours, 27 minutes ago posted by KodefuGuruKodefuGuru 1101 days, 4 hours, 9 minutes ago
Thursday, May 20, 2010 11:35:34 AM GMT Wednesday, May 19, 2010 1:53:03 PM GMT
In LINQ is Better Than ForEach, I described how to use the reduce chain refactoring to better describe the functionality of the code. By encapsulating what we were doing, the calling code became more declarative, and the the functionality was more reusable. This didn’t sit well with one reader (more)
category: Agile | clicked: 0 | comment | | source: www.kodefuguru.com
tags: Extension Methods, CSharp, Linq
4
Shouts

outcoldman: Method extension for safely type convert

posted by http://outcoldman.ru/en/site/indexhttp://outcoldman.ru/en/site/index 1155 days, 20 hours, 52 minutes ago
Thursday, March 25, 2010 9:10:39 PM GMT
Recently I read good Russian post with many interesting extensions methods after then I remembered that I too have one good extension method “Safely type convert”. Idea of this method: i = "1".To (more)
category: How To | clicked: 0 | comment | | source: outcoldman.ru
tags: .NET, Extension Methods, Convert, Parse, C
2
Shouts

Deran Schilling, Learner: Favorite Extension Methods

posted by http://derans.myopenid.com/http://derans.myopenid.com/ 1210 days, 11 hours, 7 minutes ago
Saturday, January 30, 2010 6:55:28 AM GMT
I thought I’d share some of my favorite extension methods I use regularly. I’ll go through a few extensions for MailMessage, HtmlHelper, and DirectoryEntry (for Active Directory). (more)
category: Web Dev | clicked: 0 | comment | | source: derans.blogspot.com
tags: Extension Methods, .NET 3.5
4
Shouts

Code Capers | Using Custom Security Attributes in ASP.NET MVC

posted by mceranskimceranski 1219 days, 13 hours, 30 minutes ago
Thursday, January 21, 2010 4:32:35 AM GMT
Using the Authorize attribute with "magic strings" to secure controller methods can produce some undesirable code. By using custom attributes and extension methods you can clean up your code and streamline your design. (more)
category: Web Dev | clicked: 1 | comment | | source: www.codecapers.com
tags: Extension Methods, Attributes, MVC, ASP.NET
2
Shouts

First Commit to Generic Extension Methods in Quite a While

posted by plbyrdplbyrd 1220 days, 17 hours, 35 minutes ago
Wednesday, January 20, 2010 12:26:52 AM GMT
New information about the Generic Extension Methods project. (more)
category: Architecture | clicked: 0 | comment | | source: it.toolbox.com
tags: Extension Methods, C#, OpenSource, CodePlex
3
Shouts

Implementation on Interfaces

posted by KodefuGuruKodefuGuru 1265 days, 16 hours, 31 minutes ago
Sunday, December 06, 2009 1:31:32 AM GMT
One of the things one can do with extensions methods is add implementation to an interface. It is ironic this is oftentimes overlooked, since the primary purpose of extension methods is to extend IEnumerable (more)
category: Agile | clicked: 1 | comment | | source: www.kodefuguru.com
tags: Extension Methods, Fluent, Refactor, Refactoring, Interfaces, Method Chaining
Previous 1 2 Next