Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / Runtime / InteropServices / ErrorWrapper.cs / 1 / ErrorWrapper.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*==============================================================================
**
** Class: ErrorWrapper.
**
**
** Purpose: Wrapper that is converted to a variant with VT_ERROR.
**
**
=============================================================================*/
namespace System.Runtime.InteropServices {
using System;
using System.Security.Permissions;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ErrorWrapper
{
public ErrorWrapper(int errorCode)
{
m_ErrorCode = errorCode;
}
public ErrorWrapper(Object errorCode)
{
if (!(errorCode is int))
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"), "errorCode");
m_ErrorCode = (int)errorCode;
}
[SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public ErrorWrapper(Exception e)
{
m_ErrorCode = Marshal.GetHRForException(e);
}
public int ErrorCode
{
get
{
return m_ErrorCode;
}
}
private int m_ErrorCode;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*==============================================================================
**
** Class: ErrorWrapper.
**
**
** Purpose: Wrapper that is converted to a variant with VT_ERROR.
**
**
=============================================================================*/
namespace System.Runtime.InteropServices {
using System;
using System.Security.Permissions;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ErrorWrapper
{
public ErrorWrapper(int errorCode)
{
m_ErrorCode = errorCode;
}
public ErrorWrapper(Object errorCode)
{
if (!(errorCode is int))
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"), "errorCode");
m_ErrorCode = (int)errorCode;
}
[SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public ErrorWrapper(Exception e)
{
m_ErrorCode = Marshal.GetHRForException(e);
}
public int ErrorCode
{
get
{
return m_ErrorCode;
}
}
private int m_ErrorCode;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionConverter.cs
- RewritingPass.cs
- ActivityExecutor.cs
- Brush.cs
- StateMachine.cs
- ToolStripProgressBar.cs
- EntityCommandExecutionException.cs
- DefaultObjectMappingItemCollection.cs
- SoapObjectReader.cs
- Slider.cs
- FactoryRecord.cs
- TextContainerHelper.cs
- BuildProviderCollection.cs
- DeferredSelectedIndexReference.cs
- ErrorHandlerModule.cs
- GC.cs
- DataSourceControlBuilder.cs
- CacheSection.cs
- ToolStripRenderEventArgs.cs
- PasswordTextContainer.cs
- HitTestParameters3D.cs
- InvalidateEvent.cs
- EntitySqlException.cs
- InitializeCorrelation.cs
- ProfessionalColors.cs
- XDRSchema.cs
- ProtectedUri.cs
- ImagingCache.cs
- NegationPusher.cs
- EventLogPermission.cs
- SqlDataSourceView.cs
- Win32Native.cs
- SettingsPropertyIsReadOnlyException.cs
- ISAPIWorkerRequest.cs
- OdbcFactory.cs
- NativeStructs.cs
- SuppressIldasmAttribute.cs
- SimpleWorkerRequest.cs
- SkipStoryboardToFill.cs
- LexicalChunk.cs
- RNGCryptoServiceProvider.cs
- SpeechUI.cs
- TraceHandler.cs
- ListCollectionView.cs
- EncryptedXml.cs
- XmlIlGenerator.cs
- DesignerSerializationOptionsAttribute.cs
- BridgeDataRecord.cs
- Deserializer.cs
- MultiView.cs
- TypeLibConverter.cs
- ProfileBuildProvider.cs
- TypeValidationEventArgs.cs
- ChtmlImageAdapter.cs
- dtdvalidator.cs
- CodeTypeParameter.cs
- CodeExporter.cs
- MessageSecurityOverTcpElement.cs
- Parser.cs
- InkCanvasInnerCanvas.cs
- SerializationInfoEnumerator.cs
- MenuEventArgs.cs
- Propagator.Evaluator.cs
- XmlSchemaRedefine.cs
- DataControlFieldHeaderCell.cs
- FullTextLine.cs
- FileVersionInfo.cs
- SiteMapPath.cs
- EventLogLink.cs
- ListViewGroup.cs
- SubMenuStyleCollection.cs
- DataGridDetailsPresenter.cs
- HttpPostProtocolReflector.cs
- SrgsElementFactoryCompiler.cs
- Function.cs
- KnownTypesHelper.cs
- SettingsPropertyIsReadOnlyException.cs
- HwndSourceParameters.cs
- CompilationUtil.cs
- XmlFormatExtensionAttribute.cs
- PropertyGridView.cs
- TextBox.cs
- MinMaxParagraphWidth.cs
- InstancePersistenceCommandException.cs
- FamilyMap.cs
- SymbolPair.cs
- SiteMapNode.cs
- ApplicationFileParser.cs
- ExpressionStringBuilder.cs
- MaterializeFromAtom.cs
- Maps.cs
- Frame.cs
- AtomServiceDocumentSerializer.cs
- TypeNameConverter.cs
- HtmlImageAdapter.cs
- ContentPresenter.cs
- SendMailErrorEventArgs.cs
- MouseEventArgs.cs
- SQLBinary.cs
- TypeFieldSchema.cs