Ejemplo n.º 1
0
		private void CheckNull(EmitHelper emit)
		{
			if (_throwExceptionIfNull == false && string.IsNullOrEmpty(_exceptionMessage))
			{
				emit
					.brfalse (Context.ReturnLabel)
					;
			}
			else
			{
				string message = string.Format(
					string.IsNullOrEmpty(_exceptionMessage)?
						"'{0}.{1}' is not initialized." : _exceptionMessage,
					_targetInterface.Name, _memberName, _targetInterface.FullName);

				Label label = emit.DefineLabel();

				emit
					.brtrue    (label)
					.ldstr     (message)
					.newobj    (typeof(InvalidOperationException), typeof(string))
					.@throw
					.MarkLabel (label)
					;
			}
		}