[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/runtime/System Activator.cs, 1.13, 1.14
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/runtime/System Activator.cs, 1.13, 1.14 |
Date: |
Tue, 07 Oct 2003 21:26:30 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv11549/runtime/System
Modified Files:
Activator.cs
Log Message:
Add the "CreateValueTypeInstance" internalcall, to handle the creation
of value types with the zero-argument constructor.
Index: Activator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Activator.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Activator.cs 23 Aug 2003 00:35:59 -0000 1.13
--- Activator.cs 7 Oct 2003 21:26:27 -0000 1.14
***************
*** 26,29 ****
--- 26,30 ----
using System.Reflection;
using System.Runtime.Remoting;
+ using System.Runtime.CompilerServices;
using System.Globalization;
using System.Security.Policy;
***************
*** 116,128 ****
Object[] activationAttributes)
{
- ConstructorInfo ctor;
if(type == null)
{
throw new ArgumentNullException("type");
}
return type.InvokeMember(String.Empty,
BindingFlags.CreateInstance | bindingAttr,
binder, null,
args, null, culture, null);
}
#if !ECMA_COMPAT
--- 117,137 ----
Object[] activationAttributes)
{
if(type == null)
{
throw new ArgumentNullException("type");
}
+ if(type.IsValueType && (args == null || args.Length == 0))
+ {
+ // We are instantiating a struct type with no
parameters.
+ // There is no explicitly declared constructor, so we
+ // need to do this a slightly different way.
+ return CreateValueTypeInstance(type);
+ }
return type.InvokeMember(String.Empty,
BindingFlags.CreateInstance | bindingAttr,
binder, null,
args, null, culture, null);
}
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ extern private static Object CreateValueTypeInstance(Type type);
#if !ECMA_COMPAT
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/runtime/System Activator.cs, 1.13, 1.14,
Rhys Weatherley <address@hidden> <=