Skip to content

added netstandard1.3 and netstandard2.0 for easier usage of the library #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ObjectFillerNET.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0EC5FD26-A565-4D47-A192-0FC142C3B7F0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tynamix.ObjectFiller", "Tynamix.ObjectFiller\Tynamix.ObjectFiller.csproj", "{7F8E176C-12A7-45B7-886E-5A4923B2F252}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tynamix.ObjectFiller.Test", "Tynamix.ObjectFiller.Test\Tynamix.ObjectFiller.Test.csproj", "{F2BFBBDC-E8A0-4263-AD9A-DDC87C4CD4DE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tynamix.ObjectFiller.Test", "Tynamix.ObjectFiller.Test\Tynamix.ObjectFiller.Test.csproj", "{F2BFBBDC-E8A0-4263-AD9A-DDC87C4CD4DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,6 +27,9 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {49C4194A-811F-47D8-A814-46F89C1B897E}
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = ObjectFillerNET.vsmdi
EndGlobalSection
Expand Down
32 changes: 16 additions & 16 deletions Tynamix.ObjectFiller/NetTypeApiExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static class NetTypeApiExtension
{
internal static bool IsEnum(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsEnum;
#else
return source.IsEnum;
Expand All @@ -18,7 +18,7 @@ internal static bool IsEnum(this Type source)

internal static PropertyInfo GetProperty(this Type source, string name)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().GetDeclaredProperty(name);
#else
return source.GetProperty(name);
Expand All @@ -27,7 +27,7 @@ internal static PropertyInfo GetProperty(this Type source, string name)

internal static IEnumerable<MethodInfo> GetMethods(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().DeclaredMethods;
#else
return source.GetMethods();
Expand All @@ -36,7 +36,7 @@ internal static IEnumerable<MethodInfo> GetMethods(this Type source)

internal static MethodInfo GetSetterMethod(this PropertyInfo source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.SetMethod;
#else
return source.GetSetMethod(true);
Expand All @@ -45,7 +45,7 @@ internal static MethodInfo GetSetterMethod(this PropertyInfo source)

internal static bool IsGenericType(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsGenericType;
#else
return source.IsGenericType;
Expand All @@ -55,7 +55,7 @@ internal static bool IsGenericType(this Type source)
internal static bool IsValueType(this Type source)
{

#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsValueType;
#else
return source.IsValueType;
Expand All @@ -64,7 +64,7 @@ internal static bool IsValueType(this Type source)

internal static bool IsClass(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsClass;
#else
return source.IsClass;
Expand All @@ -73,7 +73,7 @@ internal static bool IsClass(this Type source)

internal static bool IsInterface(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsInterface;
#else
return source.IsInterface;
Expand All @@ -82,7 +82,7 @@ internal static bool IsInterface(this Type source)

internal static bool IsAbstract(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().IsAbstract;
#else
return source.IsAbstract;
Expand All @@ -91,7 +91,7 @@ internal static bool IsAbstract(this Type source)

internal static IEnumerable<Type> GetImplementedInterfaces(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().ImplementedInterfaces;
#else
return source.GetInterfaces();
Expand All @@ -100,7 +100,7 @@ internal static IEnumerable<Type> GetImplementedInterfaces(this Type source)

internal static IEnumerable<PropertyInfo> GetProperties(this Type source, bool ignoreInheritance)
{
#if NETSTANDARD1_0
#if NETSTANDARD

var propertyInfos = source.GetTypeInfo().DeclaredProperties.ToList();

Expand Down Expand Up @@ -129,7 +129,7 @@ internal static IEnumerable<PropertyInfo> GetProperties(this Type source, bool i

internal static Type[] GetGenericTypeArguments(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().GenericTypeArguments;
#else
return source.GetGenericArguments();
Expand All @@ -138,7 +138,7 @@ internal static Type[] GetGenericTypeArguments(this Type source)

internal static IEnumerable<ConstructorInfo> GetConstructors(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().DeclaredConstructors;
#else
return source.GetConstructors();
Expand All @@ -147,7 +147,7 @@ internal static IEnumerable<ConstructorInfo> GetConstructors(this Type source)

internal static MethodInfo GetMethod(this Type source, string name)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().GetDeclaredMethod(name);
#else
return source.GetMethod(name);
Expand All @@ -156,7 +156,7 @@ internal static MethodInfo GetMethod(this Type source, string name)

internal static string GetModuleName(this Type source)
{
#if NETSTANDARD1_0
#if NETSTANDARD
return source.GetTypeInfo().Module.Name;
#else
return source.Module.ScopeName;
Expand All @@ -170,7 +170,7 @@ internal static Type GetTypeInfo(this Type source)
}
#endif

#if NETSTANDARD1_0
#if NETSTANDARD
internal static void ForEach<T>(this IEnumerable<T> source, Action<T> eachItem)
{
foreach (T item in source)
Expand Down
4 changes: 2 additions & 2 deletions Tynamix.ObjectFiller/Plugins/List/Collectionizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Tynamix.ObjectFiller
/// <typeparam name="T">Typeparameter of of the target List</typeparam>
/// <typeparam name="TRandomizer">Plugin which will be used to create the List</typeparam>
public class Collectionizer<T, TRandomizer> : IRandomizerPlugin<List<T>>, IRandomizerPlugin<T[]>
#if !NETSTANDARD1_0
#if !NETSTANDARD
, IRandomizerPlugin<ArrayList>
#endif
where TRandomizer : IRandomizerPlugin<T>, new()
Expand Down Expand Up @@ -120,7 +120,7 @@ T[] IRandomizerPlugin<T[]>.GetValue()
return this.GetValue().ToArray();
}

#if !NETSTANDARD1_0
#if !NETSTANDARD
/// <summary>
/// Gets random data for type <typeparamref name="T"/>
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Tynamix.ObjectFiller/Setup/FillerSetupItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void SetDefaultRandomizer()
this.TypeToRandomFunc[typeof(TimeSpan)] = () => new TimeSpan(Random.Next());
this.TypeToRandomFunc[typeof(TimeSpan?)] = () => new TimeSpan(Random.Next());
this.TypeToRandomFunc[typeof(Uri)] = () => uriRandomizer.GetValue();
#if !NETSTANDARD1_0
#if !NETSTANDARD
this.TypeToRandomFunc[typeof(ArrayList)] = () => ((IRandomizerPlugin<ArrayList>)new Collectionizer<string, MnemonicString>()).GetValue();
#endif
}
Expand Down
Loading