Format:
Recent snippets matching tags of Type
//start processing var api = new moviesApi(); api.getRatings({ success: function (result) { for (var i = 0; i < result.length; i++) { //new Option(text, value) var option = new Option(result[i].ID, result[i].Name); $('#ratings').append( $('<option></option>').val(result[i].ID).html(result[i].Name) );
22 Views
no comments
//Create and type variable var moviesApi = function () { } moviesApi.prototype.getRatings = function (options) { $.ajax({ url: applicationUrl + '/Api/movies/getratings', type: 'GET', success: options.success, error: function (result) { displayError(result);
31 Views
no comments
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); } }
62 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>
192 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
292 Views
no comments
[Mixin("String.prototype")] public static class StringExtensions { public static bool StartsWith(string value) { return ((string)Script.Literal("this")).IndexOf(value) == 0; } }
351 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* {
258 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 //***************************************
426 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>();
499 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>();
336 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>
1373 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;
723 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) {
527 Views
no comments
namespace Repository.EntityFramework { //Entity Class Under Test public partial class Story { public ICollection<Tag> Tags { get { if(!TagsInternal.IsLoaded)
384 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) {
366 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
