Automatically exported from code.google.com/p/fast-member
C# Batchfile
Latest commit f03df36 Jan 11, 2017 @mgravell Tests project for preview4... well, kinda maybe working-ish but also …
…completely breaks the IDE
Permalink
Failed to load latest commit information.
.nuget 1.0.0.7; add basic type metadata Nov 8, 2012
FastMember.Signed.Tests Tests project for preview4... well, kinda maybe working-ish but also … Jan 11, 2017
FastMember.Signed yet more preview4 crazy (core libs) Jan 11, 2017
FastMember.Tests Tests project for preview4... well, kinda maybe working-ish but also … Jan 11, 2017
FastMember yet more preview4 crazy (core libs) Jan 11, 2017
FastMember_Net20 Added missing #define COREFX and CoreFx methods Dec 20, 2016
FastMember_Net35 Added missing #define COREFX and CoreFx methods Dec 20, 2016
FastMember_Net40.Signed.Tests Added missing #define COREFX and CoreFx methods Dec 20, 2016
FastMember_Net40.Signed Added missing #define COREFX and CoreFx methods Dec 20, 2016
FastMember_Net40.Tests Merge branch 'master' of github.com:mgravell/fast-member into axunonb… Jan 10, 2017
FastMember_Net40 Added missing #define COREFX and CoreFx methods Dec 20, 2016
Nuget Update nuspec projectUrl Feb 27, 2016
NugetSigned optimized for large numbers of members; add mutate struct support Sep 22, 2013
.gitignore Add minimal (non-working) project.json and DNX sln Nov 23, 2015
.hgignore package tweaks to support .net 3.5 Apr 13, 2012
FastMember.Core.sln Attempt to move to preview4 Jan 10, 2017
FastMember.sln .Net Framework 2.0 Compatibility Sep 7, 2016
FastMember.snk Update to VS2015 build tools / NUnit 3; change SNK, because I suck an… Nov 23, 2015
Nuget.config Convert perf test to use BenchmarkDotNet Feb 22, 2016
Readme.md tidy up Feb 27, 2016
pack.cmd optimized for large numbers of members; add mutate struct support Sep 22, 2013

Readme.md

Fast access to .net fields/properties

In .NET reflection is slow... well, kinda slow. If you need access to the members of an arbitrary type, with the type and member-names known only at runtime - then it is frankly hard (especially for DLR types). This library makes such access easy and fast.

An introduction to the reasons behind fast-member can be found on my blog; example usage is simply:

var accessor = TypeAccessor.Create(type); 
string propName = // something known only at runtime 
while( /* some loop of data */ )
{ 
  accessor[obj, propName] = rowValue; 
}

or

// obj could be static or DLR 
var wrapped = ObjectAccessor.Create(obj);
string propName = // something known only at runtime 
Console.WriteLine(wrapped[propName]);

Ever needed an IDataReader?

This is pretty common if you are doing object-mapping between an object model and ADO.NET concepts such as DataTable or SqlBulkCopy; loading a DataTable (yes, some people still use it) from a sequence of typed objects can now be as easy as:

IEnumerable<SomeType> data = ... 
var table = new DataTable(); 
using(var reader = ObjectReader.Create(data)) 
{ 
  table.Load(reader); 
}

(the Create method offers parameters to control the specific members, if needed)

Or if you want to throw the data into a database as fast as humanly possible:

using(var bcp = new SqlBulkCopy(connection)) 
using(var reader = ObjectReader.Create(data, "Id", "Name", "Description")) 
{ 
  bcp.DestinationTableName = "SomeTable"; 
  bcp.WriteToServer(reader); 
}