mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 20:13:40 +00:00
Reflection abstractions to reduce code duplication
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Octokit.Reflection;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
internal static class ReflectionExtensions
|
||||
{
|
||||
public static IEnumerable<PropertyOrField> GetPropertiesAndFields(this Type type)
|
||||
{
|
||||
return ReflectionUtils.GetProperties(type).Select(property => new PropertyOrField(property))
|
||||
.Union(ReflectionUtils.GetFields(type).Select(field => new PropertyOrField(field)))
|
||||
.Where(p => p.IsPublic && !p.IsStatic);
|
||||
}
|
||||
|
||||
public static bool IsDateTimeOffset(this Type type)
|
||||
{
|
||||
return type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?);
|
||||
|
||||
Reference in New Issue
Block a user