Files
acceptance-tests
data
debian
docs
external
ikvm-native
libgc
llvm
m4
man
mcs
build
class
Accessibility
Commons.Xml.Relaxng
Cscompmgd
CustomMarshalers
Facades
I18N
IBM.Data.DB2
ICSharpCode.SharpZipLib
Microsoft.Build
Microsoft.Build.Engine
Microsoft.Build.Framework
Microsoft.Build.Tasks
Microsoft.Build.Utilities
Microsoft.CSharp
Microsoft.NuGet.Build.Tasks
Microsoft.VisualC
Microsoft.Web.Infrastructure
MicrosoftAjaxLibrary
Mono.Btls.Interface
Mono.C5
Mono.CSharp
Mono.Cairo
Mono.Cecil
Mono.Cecil.Mdb
Mono.CodeContracts
Mono.CompilerServices.SymbolWriter
Mono.Data.Sqlite
Mono.Data.Tds
Mono.Debugger.Soft
Mono.Http
Mono.Management
Mono.Messaging
Mono.Messaging.RabbitMQ
Mono.Options
Mono.Parallel
Mono.Posix
Mono.Profiler.Log
Mono.Runtime.Tests
Mono.Security
Mono.Security.Win32
Mono.Simd
Mono.Tasklets
Mono.WebBrowser
Mono.XBuild.Tasks
Novell.Directory.Ldap
PEAPI
RabbitMQ.Client
SMDiagnostics
System
System.ComponentModel.Composition.4.5
System.ComponentModel.DataAnnotations
System.Configuration
System.Configuration.Install
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Linq
System.Data.OracleClient
System.Data.Services
System.Data.Services.Client
System.Deployment
System.Design
System.DirectoryServices
System.DirectoryServices.Protocols
System.Drawing
System.Drawing.Design
System.Dynamic
System.EnterpriseServices
System.IO.Compression
System.IO.Compression.FileSystem
System.IdentityModel
System.IdentityModel.Selectors
System.Json
System.Json.Microsoft
System.Management
System.Messaging
System.Net
System.Net.Http
System.Net.Http.Formatting
System.Net.Http.WebRequest
System.Net.Http.WinHttpHandler
System.Numerics
System.Numerics.Vectors
System.Private.CoreLib
System.Reactive.Core
System.Reactive.Debugger
System.Reactive.Experimental
System.Reactive.Interfaces
System.Reactive.Linq
System.Reactive.Observable.Aliases
System.Reactive.PlatformServices
System.Reactive.Providers
System.Reactive.Runtime.Remoting
System.Reactive.Windows.Forms
System.Reactive.Windows.Threading
System.Reflection.Context
System.Runtime.Caching
System.Runtime.CompilerServices.Unsafe
System.Runtime.DurableInstancing
System.Runtime.Remoting
System.Runtime.Serialization
System.Runtime.Serialization.Formatters.Soap
System.Security
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.Web
System.ServiceProcess
System.Threading.Tasks.Dataflow
System.Transactions
System.Web
System.Web.Abstractions
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Extensions
System.Web.Extensions.Design
System.Web.Http
System.Web.Http.SelfHost
System.Web.Http.WebHost
System.Web.Mobile
System.Web.Mvc3
System.Web.Razor
System.Web.RegularExpressions
System.Web.Routing
System.Web.Services
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Windows
System.Windows.Forms
System.Windows.Forms.DataVisualization
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.XML
System.Xaml
System.Xml.Linq
System.Xml.Serialization
SystemWebTestShim
WebMatrix.Data
WindowsBase
aot-compiler
corlib
Assembly
CommonCrypto
CoreFoundation
Documentation
LinkerDescriptor
Microsoft.Win32
Mono
Mono.Globalization.Unicode
Mono.Interop
Mono.Security
Mono.Security.Cryptography
Mono.Xml
ReferenceSources
System
ActivationContext.cs
AndroidPlatform.cs
AppDomain.cs
AppDomain.pns.cs
AppDomainInitializer.cs
AppDomainManager.cs
AppDomainSetup.cs
ApplicationIdentity.cs
ArgIterator.cs
Array.cs
BitConverter.cs
CStreamReader.cs
CStreamWriter.cs
Console.cs
Console.iOS.cs
ConsoleDriver.cs
ControlCharacters.cs
CrossAppDomainDelegate.cs
Delegate.cs
DelegateSerializationHolder.cs
DomainManagerInitializationFlags.cs
EmptyArray.cs
Environment.cs
Environment.iOS.cs
EnvironmentVariableTarget.cs
Guid.cs
IConsoleDriver.cs
IntPtr.cs
KnownTerminals.cs
MarshalByRefObject.cs
MathF.mono.cs
ModuleHandle.cs
MonoAsyncCall.cs
MonoCQItem.cs
MonoCustomAttrs.cs
MonoListItem.cs
MonoTouchAOTHelper.cs
MonoType.cs
MulticastDelegate.cs
NotSupportedException.iOS.cs
NullConsoleDriver.cs
Nullable.cs
NumberFormatter.cs
Object.cs
PlatformID.cs
RuntimeArgumentHandle.cs
RuntimeFieldHandle.cs
RuntimeMethodHandle.cs
RuntimeTypeHandle.cs
TermInfoBooleans.cs
TermInfoDriver.cs
TermInfoNumbers.cs
TermInfoReader.cs
TermInfoStrings.cs
TimeZoneInfo.Android.cs
TimeZoneInfo.MonoTouch.cs
TimeZoneInfo.Serialization.cs
TimeZoneInfo.WebAssembly.cs
TimeZoneInfo.WinRT.cs
TimeZoneInfo.cs
TypeIdentifier.cs
TypeSpec.cs
UIntPtr.cs
ValueType.cs
Variant.cs
WeakAttribute.cs
WeakReference.cs
WeakReference_T.cs
WindowsConsoleDriver.cs
__ComObject.cs
System.Configuration.Assemblies
System.Deployment.Internal
System.Diagnostics
System.Diagnostics.SymbolStore
System.Diagnostics.Tracing
System.Globalization
System.IO
System.IO.Enumeration
System.IO.IsolatedStorage
System.Reflection
System.Reflection.Emit
System.Reflection.Metadata
System.Resources
System.Runtime
System.Runtime.CompilerServices
System.Runtime.Hosting
System.Runtime.InteropServices
System.Runtime.InteropServices.RuntimeInformation
System.Runtime.InteropServices.WindowsRuntime
System.Runtime.Remoting
System.Runtime.Remoting.Activation
System.Runtime.Remoting.Channels
System.Runtime.Remoting.Contexts
System.Runtime.Remoting.Lifetime
System.Runtime.Remoting.Messaging
System.Runtime.Remoting.Metadata
System.Runtime.Remoting.Metadata.W3cXsd2001
System.Runtime.Remoting.Proxies
System.Runtime.Remoting.Services
System.Runtime.Versioning
System.Security
System.Security.AccessControl
System.Security.Cryptography
System.Security.Cryptography.X509Certificates
System.Security.Permissions
System.Security.Policy
System.Security.Principal
System.Text
System.Threading
Test
coreclr
corefx
corert
il
legacy
resources
Makefile
System.IO.platformnotsupported.sources
corlib.dll.sources.REMOVED.git-id
corlib_test.dll.sources
corlib_xtest.dll.sources
linux_build_corlib.dll.exclude.sources
linux_build_corlib.dll.sources
linux_net_4_x_corlib.dll.exclude.sources
linux_net_4_x_corlib.dll.sources
macos_build_corlib.dll.exclude.sources
macos_build_corlib.dll.sources
macos_net_4_x_corlib.dll.exclude.sources
macos_net_4_x_corlib.dll.sources
mobile_tests.exclude.sources
monodroid_corlib.dll.exclude.sources
monodroid_corlib.dll.sources
monodroid_corlib_test.dll.exclude.sources
monodroid_corlib_xtest.dll.exclude.sources
monotouch_corlib.dll.exclude.sources
monotouch_corlib.dll.sources
monotouch_corlib_test.dll.exclude.sources
monotouch_corlib_xtest.dll.exclude.sources
monotouch_runtime_corlib.dll.exclude.sources
monotouch_runtime_corlib.dll.sources
monotouch_tv_corlib.dll.exclude.sources
monotouch_tv_corlib.dll.sources
monotouch_tv_corlib_test.dll.exclude.sources
monotouch_tv_corlib_xtest.dll.exclude.sources
monotouch_tv_runtime_corlib.dll.exclude.sources
monotouch_tv_runtime_corlib.dll.sources
monotouch_watch_corlib.dll.exclude.sources
monotouch_watch_corlib.dll.sources
monotouch_watch_corlib_test.dll.exclude.sources
monotouch_watch_corlib_xtest.dll.exclude.sources
monotouch_watch_runtime_corlib.dll.exclude.sources
monotouch_watch_runtime_corlib.dll.sources
net_4_x_corlib.dll.sources
orbis_corlib.dll.exclude.sources
orbis_corlib.dll.sources
orbis_corlib_test.dll.exclude.sources
testing_aot_common_corlib.dll.exclude.sources
testing_aot_common_corlib.dll.sources
testing_aot_common_corlib_test.dll.exclude.sources
testing_aot_full_corlib.dll.exclude.sources
testing_aot_full_corlib.dll.sources
testing_aot_full_corlib_test.dll.exclude.sources
testing_aot_full_interp_corlib.dll.exclude.sources
testing_aot_full_interp_corlib.dll.sources
testing_aot_full_interp_corlib_test.dll.exclude.sources
testing_aot_hybrid_corlib.dll.exclude.sources
testing_aot_hybrid_corlib.dll.sources
testing_aot_hybrid_corlib_test.dll.exclude.sources
unix_build_corlib.dll.exclude.sources
unix_build_corlib.dll.sources
unix_net_4_x_corlib.dll.exclude.sources
unix_net_4_x_corlib.dll.sources
unreal_corlib.dll.exclude.sources
unreal_corlib.dll.sources
wasm_corlib.dll.exclude.sources
wasm_corlib.dll.sources
wasm_corlib_test.dll.exclude.sources
wasm_corlib_xtest.dll.exclude.sources
win32_build_corlib.dll.exclude.sources
win32_build_corlib.dll.sources
win32_monodroid_corlib.dll.exclude.sources
win32_monodroid_corlib.dll.sources
win32_monodroid_corlib_test.dll.exclude.sources
win32_net_4_x_corlib.dll.exclude.sources
win32_net_4_x_corlib.dll.sources
win32_net_4_x_corlib_test.dll.exclude.sources
win32_net_4_x_corlib_test.dll.sources
win32_net_4_x_corlib_xtest.dll.sources
winaot_corlib.dll.exclude.sources
winaot_corlib.dll.sources
winaot_corlib_test.dll.exclude.sources
winaot_corlib_test.dll.sources
xammac_corlib.dll.exclude.sources
xammac_corlib.dll.sources
xammac_corlib_test.dll.exclude.sources
xammac_corlib_xtest.dll.exclude.sources
xammac_net_4_5_corlib.dll.exclude.sources
xammac_net_4_5_corlib.dll.sources
dlr
doc
legacy
lib
monodoc
notes
reference-assemblies
referencesource
test-helpers
LICENSE
Makefile
Open.snk
README
ecma.pub
mono.pub
mono.snk
msfinal.pub
reactive.pub
silverlight.pub
winfx.pub
winfx3.pub
docs
errors
ilasm
jay
mcs
packages
tests
tools
AUTHORS
COPYING
INSTALL.txt
Makefile
MonoIcon.png
README
ScalableMonoIcon.svg
mkinstalldirs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/mcs/class/corlib/System/RuntimeFieldHandle.cs

132 lines
4.1 KiB
C#
Raw Normal View History

//
// System.RuntimeFieldHandle.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.CompilerServices;
namespace System
{
[ComVisible (true)]
[Serializable]
public struct RuntimeFieldHandle : ISerializable
{
IntPtr value;
internal RuntimeFieldHandle (IntPtr v)
{
value = v;
}
RuntimeFieldHandle (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
RuntimeFieldInfo mf = ((RuntimeFieldInfo) info.GetValue ("FieldObj", typeof (RuntimeFieldInfo)));
value = mf.FieldHandle.Value;
if (value == IntPtr.Zero)
throw new SerializationException ("Insufficient state.");
}
public IntPtr Value {
get {
return value;
}
}
internal bool IsNullHandle ()
{
return value == IntPtr.Zero;
}
public void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
if (value == IntPtr.Zero)
throw new SerializationException ("Object fields may not be properly initialized");
info.AddValue ("FieldObj", (RuntimeFieldInfo) FieldInfo.GetFieldFromHandle (this), typeof (RuntimeFieldInfo));
}
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
public override bool Equals (object obj)
{
if (obj == null || GetType () != obj.GetType ())
return false;
return value == ((RuntimeFieldHandle)obj).Value;
}
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
public bool Equals (RuntimeFieldHandle handle)
{
return value == handle.Value;
}
public override int GetHashCode ()
{
return value.GetHashCode ();
}
public static bool operator == (RuntimeFieldHandle left, RuntimeFieldHandle right)
{
return left.Equals (right);
}
public static bool operator != (RuntimeFieldHandle left, RuntimeFieldHandle right)
{
return !left.Equals (right);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void SetValueInternal (FieldInfo fi, object obj, object value);
internal static void SetValue (RuntimeFieldInfo field, Object obj, Object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized)
{
SetValueInternal (field, obj, value);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static unsafe extern internal Object GetValueDirect (RuntimeFieldInfo field, RuntimeType fieldType, void *pTypedRef, RuntimeType contextType);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static unsafe extern internal void SetValueDirect (RuntimeFieldInfo field, RuntimeType fieldType, void* pTypedRef, Object value, RuntimeType contextType);
}
}