[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public sealed class AttributeUsageAttribute : Attribute
{
- internal AttributeTargets m_attributeTarget = AttributeTargets.All; // Defaults to all
- internal bool m_allowMultiple = false; // Defaults to false
- internal bool m_inherited = true; // Defaults to true
+ private AttributeTargets _attributeTarget = AttributeTargets.All; // Defaults to all
+ private bool _allowMultiple = false; // Defaults to false
+ private bool _inherited = true; // Defaults to true
internal static AttributeUsageAttribute Default = new AttributeUsageAttribute(AttributeTargets.All);
//Constructors
public AttributeUsageAttribute(AttributeTargets validOn)
{
- m_attributeTarget = validOn;
+ _attributeTarget = validOn;
}
internal AttributeUsageAttribute(AttributeTargets validOn, bool allowMultiple, bool inherited)
{
- m_attributeTarget = validOn;
- m_allowMultiple = allowMultiple;
- m_inherited = inherited;
+ _attributeTarget = validOn;
+ _allowMultiple = allowMultiple;
+ _inherited = inherited;
}
-
- //Properties
public AttributeTargets ValidOn
{
- get { return m_attributeTarget; }
+ get { return _attributeTarget; }
}
public bool AllowMultiple
{
- get { return m_allowMultiple; }
- set { m_allowMultiple = value; }
+ get { return _allowMultiple; }
+ set { _allowMultiple = value; }
}
public bool Inherited
{
- get { return m_inherited; }
- set { m_inherited = value; }
+ get { return _inherited; }
+ set { _inherited = value; }
}
}
}
public sealed override void ReorderArgumentArray(ref object[] args, object state)
{
BinderState binderState = (BinderState)state;
- ReorderParams(binderState.m_argsMap, args);
- if (binderState.m_isParamArray)
+ ReorderParams(binderState._argsMap, args);
+ if (binderState._isParamArray)
{
int paramArrayPos = args.Length - 1;
- if (args.Length == binderState.m_originalSize)
+ if (args.Length == binderState._originalSize)
args[paramArrayPos] = ((object[])args[paramArrayPos])[0];
else
{
}
else
{
- if (args.Length > binderState.m_originalSize)
+ if (args.Length > binderState._originalSize)
{
- object[] newArgs = new object[binderState.m_originalSize];
- Array.Copy(args, 0, newArgs, 0, binderState.m_originalSize);
+ object[] newArgs = new object[binderState._originalSize];
+ Array.Copy(args, 0, newArgs, 0, binderState._originalSize);
args = newArgs;
}
}
internal class BinderState
{
- internal int[] m_argsMap;
- internal int m_originalSize;
- internal bool m_isParamArray;
+ internal readonly int[] _argsMap;
+ internal readonly int _originalSize;
+ internal readonly bool _isParamArray;
internal BinderState(int[] argsMap, int originalSize, bool isParamArray)
{
- m_argsMap = argsMap;
- m_originalSize = originalSize;
- m_isParamArray = isParamArray;
+ _argsMap = argsMap;
+ _originalSize = originalSize;
+ _isParamArray = isParamArray;
}
}
}
[NonSerialized]
private Func<T> _factory;
- // m_value eventually stores the lazily created value. It is valid when _state = null.
+ // _value eventually stores the lazily created value. It is valid when _state = null.
private T _value;
/// <summary>
// ...
// realSerializedDataN
// safeSerializationData -> this is the serialization data member of the parent type
- // m_serializedState -> list of saved serialized states from subclasses responding to the safe
+ // _serializedState -> list of saved serialized states from subclasses responding to the safe
// serialization event
// RealTypeSerializationName -> type which is using safe serialization
// Type:
//
// 1. Include a data member of type SafeSerializationManager:
//
- // private SafeSerializationManager m_safeSerializationManager;
+ // private SafeSerializationManager _safeSerializationManager;
//
// 2. Add a protected SerializeObjectState event, which passes through to the SafeSerializationManager:
//
// protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
// {
- // add { m_safeSerializationManager.SerializeObjectState += value; }
- // remove { m_safeSerializationManager.SerializeObjectState -= value; }
+ // add { _safeSerializationManager.SerializeObjectState += value; }
+ // remove { _safeSerializationManager.SerializeObjectState -= value; }
// }
//
// 3. Serialize the safe serialization object in GetObjectData, and call its CompleteSerialization method:
//
// {
- // info.AddValue("m_safeSerializationManager", m_safeSerializationManager, typeof(SafeSerializationManager));
- // m_safeSerializationManager.CompleteSerialization(this, info, context);
+ // info.AddValue("_safeSerializationManager", _safeSerializationManager, typeof(SafeSerializationManager));
+ // _safeSerializationManager.CompleteSerialization(this, info, context);
// }
//
// 4. Add an OnDeserialized handler if one doesn't already exist, and call CompleteDeserialization in it:
// [OnDeserialized]
// private void OnDeserialized(StreamingContext context)
// {
- // m_safeSerializationManager.CompleteDeserialization(this);
+ // _safeSerializationManager.CompleteDeserialization(this);
// }
//
// On the client side, using safe serialization is also pretty easy. For example:
// [Serializable]
// private struct TransparentExceptionState : ISafeSerializationData
// {
- // public string m_extraData;
+ // public string _extraData;
//
// void ISafeSerializationData.CompleteDeserialization(object obj)
// {
// TransparentException exception = obj as TransparentException;
- // exception.m_state = this;
+ // exception._state = this;
// }
// }
//
// [NonSerialized]
- // private TransparentExceptionState m_state = new TransparentExceptionState();
+ // private TransparentExceptionState _state = new TransparentExceptionState();
//
// public TransparentException()
// {
// SerializeObjectState += delegate(object exception, SafeSerializationEventArgs eventArgs)
// {
- // eventArgs.AddSerializedState(m_state);
+ // eventArgs.AddSerializedState(_state);
// };
// }
//
// public string ExtraData
// {
- // get { return m_state.m_extraData; }
- // set { m_state.m_extraData = value; }
+ // get { return _state._extraData; }
+ // set { _state._extraData = value; }
// }
// }
//