Format:
Recent snippets matching tags of reflection
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
using System; using System.Collections.Generic; using System.Xml.Linq; using FizzWare.NBuilder; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Tests.Reporting { [TestClass] public class DynamicXmlFormatting
128 Views
no comments
using System; using System.Collections.Generic; using FizzWare.NBuilder; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Tests.Reporting { [TestClass] public class DynamicTextFormatting {
137 Views
no comments
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Diagnostics;
namespace ConsoleApplication1
{
public class Program
274 Views
no comments
// usage class Person { ICollection<Address> Addresses { get; set; } } person.Ensure(p => p.Addresses); // implementation public static class Crap {
135 Views
1 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>();
293 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>
1280 Views
no comments
// create instance of class DateTime DateTime dateTime = (DateTime)Activator.CreateInstance(typeof(DateTime)); // create instance of DateTime, use constructor with parameters (year, month, day) DateTime dateTime = (DateTime)Activator.CreateInstance(typeof(DateTime), new object[] { 2008, 7, 4 }); //namespace Test //{
215 Views
no comments
typeof ( WebPartChrome ).GetMethod ( "RenderVerbsInTitleBar", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance ).Invoke ( this, new object[] { writer, webPart, 1 } );
215 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
