C# Класс IronPython.Runtime.Types.ReflectedField

Наследование: PythonTypeSlot, ICodeFormattable
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
DoSet void
IsSetDescriptor bool
MakeGetExpression void
ShouldSetOrDelete bool
TryDeleteValue bool
TryGetValue bool
TrySetValue bool
TrySetValueWorker bool
__delete__ void

Открытые методы

Метод Описание
GetValue ( Microsoft.Scripting.CodeContext context, object instance ) : object

Convenience function for users to call directly

ReflectedField ( FieldInfo info ) : System.Linq.Expressions
ReflectedField ( FieldInfo info, NameType nameType ) : System.Linq.Expressions
SetValue ( Microsoft.Scripting.CodeContext context, object instance, object value ) : void

This function can be used to set a field on a value type without emitting a warning. Otherwise it is provided only to have symmetry with properties which have GetValue/SetValue for supporting explicitly implemented interfaces. Setting fields on value types usually warns because it can silently fail to update the value you expect. For example consider this example where Point is a value type with the public fields X and Y: arr = System.Array.CreateInstance(Point, 10) arr[0].X = 42 print arr[0].X prints 0. This is because reading the value from the array creates a copy of the value. Setting the value then mutates the copy and the array does not get updated. The same problem exists when accessing members of a class.

__repr__ ( Microsoft.Scripting.CodeContext context ) : string
__set__ ( Microsoft.Scripting.CodeContext context, object instance, object value ) : void

Приватные методы

Метод Описание
DoSet ( Microsoft.Scripting.CodeContext context, object instance, object val, bool suppressWarning ) : void
IsSetDescriptor ( Microsoft.Scripting.CodeContext context, IronPython.Runtime.Types.PythonType owner ) : bool
MakeGetExpression ( PythonBinder binder, Expression codeContext, DynamicMetaObject instance, DynamicMetaObject owner, ConditionalBuilder builder ) : void
ShouldSetOrDelete ( IronPython.Runtime.Types.PythonType type ) : bool
TryDeleteValue ( Microsoft.Scripting.CodeContext context, object instance, IronPython.Runtime.Types.PythonType owner ) : bool
TryGetValue ( Microsoft.Scripting.CodeContext context, object instance, IronPython.Runtime.Types.PythonType owner, object &value ) : bool
TrySetValue ( Microsoft.Scripting.CodeContext context, object instance, IronPython.Runtime.Types.PythonType owner, object value ) : bool
TrySetValueWorker ( Microsoft.Scripting.CodeContext context, object instance, IronPython.Runtime.Types.PythonType owner, object value, bool suppressWarning ) : bool
__delete__ ( object instance ) : void

Описание методов

GetValue() публичный Метод

Convenience function for users to call directly
public GetValue ( Microsoft.Scripting.CodeContext context, object instance ) : object
context Microsoft.Scripting.CodeContext
instance object
Результат object

ReflectedField() публичный Метод

public ReflectedField ( FieldInfo info ) : System.Linq.Expressions
info System.Reflection.FieldInfo
Результат System.Linq.Expressions

ReflectedField() публичный Метод

public ReflectedField ( FieldInfo info, NameType nameType ) : System.Linq.Expressions
info System.Reflection.FieldInfo
nameType NameType
Результат System.Linq.Expressions

SetValue() публичный Метод

This function can be used to set a field on a value type without emitting a warning. Otherwise it is provided only to have symmetry with properties which have GetValue/SetValue for supporting explicitly implemented interfaces. Setting fields on value types usually warns because it can silently fail to update the value you expect. For example consider this example where Point is a value type with the public fields X and Y: arr = System.Array.CreateInstance(Point, 10) arr[0].X = 42 print arr[0].X prints 0. This is because reading the value from the array creates a copy of the value. Setting the value then mutates the copy and the array does not get updated. The same problem exists when accessing members of a class.
public SetValue ( Microsoft.Scripting.CodeContext context, object instance, object value ) : void
context Microsoft.Scripting.CodeContext
instance object
value object
Результат void

__repr__() публичный Метод

public __repr__ ( Microsoft.Scripting.CodeContext context ) : string
context Microsoft.Scripting.CodeContext
Результат string

__set__() публичный Метод

public __set__ ( Microsoft.Scripting.CodeContext context, object instance, object value ) : void
context Microsoft.Scripting.CodeContext
instance object
value object
Результат void