Format:
Recent snippets matching tags of type
public static class TypeEx { public static string GetFriendlyName(this Type t) { using (var provider = new CSharpCodeProvider()) { var typeRef = new CodeTypeReference(t); return provider.GetTypeOutput(typeRef); } }
28 Views
no comments
public class ObjectFactory<T> where T: class, new() { ... /// <summary> /// Returns a unique ID for a given type and parameter signature /// </summary> /// <typeparam name="T"></typeparam>
164 Views
1 comments
#include <new> #include <utility> // This macro is variadic in order to directly support operator, #define BOOST_AUTO_FUNCTION( ... ) auto __VA_ARGS__ -> BOOST_AUTO_FUNCTION_IMPL #define BOOST_AUTO_VOID_FUNCTION( ... ) \ auto __VA_ARGS__ -> BOOST_AUTO_VOID_FUNCTION_IMPL // Variadic to support expressions with commas not between parentheses
260 Views
no comments
[Mixin("String.prototype")] public static class StringExtensions { public static bool StartsWith(string value) { return ((string)Script.Literal("this")).IndexOf(value) == 0; } }
302 Views
1 comments
// Define a list by enclosing the item type in brackets [int] // and initialize its value. Scores : [int] = [ 92, 100, 85, 62, 81, 100 ]; // Option A // require the stream type to be specified on a property PassingScores : int* {
235 Views
no comments
//*************************************** // Description: Display images in a simple teletype style. // Usage: $(".teletype").teletype({speed: 100}); // Put all images in wrapper <div> // e.g : <div class="teletype"><img src="/images/1.jpg" alt="" width="10" height="10"/> ... </div> // Ensure the images are hidden // e.g : .teletype img { display: none } // Params example: ({speed:100},{type:"fast"}); // Written by: Arran Maclean , A R Media Ltd. 22/03/2010 //***************************************
370 Views
no comments
/// <summary> /// Return all properties from a type up to a specified base type in the inheritance hierarchy /// </summary> /// <param name="type">Type that will be examined</param> /// <param name="baseType">Where to stop in the inheritance hierarchy. Must be a type that first parameter inherits from /// </param> /// <returns>A list of all found properties</returns> public static List<PropertyInfo> GetAllProperties(Type type, Type baseType) { List<PropertyInfo> properties = new List<PropertyInfo>();
438 Views
no comments
/// <summary> /// Return all properties from a type up to a specified base type in the inheritance hierarchy /// </summary> /// <param name="type">Type that will be examined</param> /// <param name="baseType">Where to stop in the inheritance hierarchy. Must be a type that first parameter inherits from /// </param> /// <returns>A list of all found properties</returns> public static List<PropertyInfo> GetAllProperties(Type type, Type baseType) { List<PropertyInfo> properties = new List<PropertyInfo>();
292 Views
no comments
/// <summary> /// Turns a string into a typed value generically. /// Explicitly assigns common types and falls back /// on using type converters for unhandled types. /// /// Common uses: /// * UI -> to data conversions /// * Parsers /// <seealso>Class ReflectionUtils</seealso> /// </summary>
1279 Views
no comments
// ********************************** // By Roy Osherove : www.osherove.com // see example usage of this code at http://weblogs.asp.net/rosherove/archive/2009/10/23/typemoq-api.aspx // ********************************** using System; using System.Linq; using System.Linq.Expressions; using TypeMock.ArrangeActAssert;
687 Views
no comments
//Class Under Test public class CategoryRepository : BaseRepository<Category> { //EntityContainer is an ObjectContext public CategoryRepository(EntityContainer context) : base(context){} //Method Under Test public Category FindById(Guid id) {
479 Views
no comments
namespace Repository.EntityFramework { //Entity Class Under Test public partial class Story { public ICollection<Tag> Tags { get { if(!TagsInternal.IsLoaded)
354 Views
no comments
//Class under test code snippet public class CategoryRepository : BaseRepository<Category> { //EntityContainer class is an ObjectContext of Entity Framework public CategoryRepository(EntityContainer context) : base(context) { } public override void Add(Category category) {
333 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
