summaryrefslogtreecommitdiff
path: root/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
diff options
context:
space:
mode:
authorjiseob.jang <jiseob.jang@samsung.com>2017-09-06 11:40:24 (GMT)
committerjiseob.jang <jiseob.jang@samsung.com>2017-09-07 02:55:42 (GMT)
commitcb9516da9df966079e5a34490139eec68c38dafa (patch)
tree39d5565943e78c35dd013cc771ed2980788fff38 /src/mscorlib/shared/System/Reflection/ParameterInfo.cs
parent61d6a817e39d3bae0f47dbc09838d51db22a5d30 (diff)
downloadcoreclr-upstream.zip
coreclr-upstream.tar.gz
coreclr-upstream.tar.bz2
Imported Upstream version 2.0.0.12082upstream/2.0.0.12082upstream
Diffstat (limited to 'src/mscorlib/shared/System/Reflection/ParameterInfo.cs')
-rw-r--r--src/mscorlib/shared/System/Reflection/ParameterInfo.cs41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/mscorlib/shared/System/Reflection/ParameterInfo.cs b/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
index fd130e5..94bfffa 100644
--- a/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
+++ b/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
@@ -54,7 +54,46 @@ namespace System.Reflection
public object GetRealObject(StreamingContext context)
{
- throw new PlatformNotSupportedException();
+ // Once all the serializable fields have come in we can set up the real
+ // instance based on just two of them (MemberImpl and PositionImpl).
+
+ if (MemberImpl == null)
+ throw new SerializationException(SR.Serialization_InsufficientState);
+
+ ParameterInfo[] args = null;
+
+ switch (MemberImpl.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ if (PositionImpl == -1)
+ {
+ if (MemberImpl.MemberType == MemberTypes.Method)
+ return ((MethodInfo)MemberImpl).ReturnParameter;
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+ else
+ {
+ args = ((MethodBase)MemberImpl).GetParametersNoCopy();
+
+ if (args != null && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+
+ case MemberTypes.Property:
+ args = ((PropertyInfo)MemberImpl).GetIndexParameters();
+
+ if (args != null && PositionImpl > -1 && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+
+ default:
+ throw new SerializationException(SR.Serialization_NoParameterInfo);
+ }
}
public override string ToString() => ParameterType.FormatTypeName() + " " + Name;