RuntimeCompatibilityAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <AttributeUsageAttribute(AttributeTargets.Assembly, Inherited:=False, AllowMultiple:=False)> _ Public NotInheritable Class RuntimeCompatibilityAttribute Inherits Attribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)] public sealed class RuntimeCompatibilityAttribute : Attribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets::Assembly, Inherited=false, AllowMultiple=false)] public ref class RuntimeCompatibilityAttribute sealed : public Attribute

C++ など、一部の言語では、任意の型の例外をスローできます。これに対し、Microsoft C# や Visual Basic など、それ以外の言語では、スローされる例外はすべて Exception クラスから派生している必要があります。これらの言語間の互換性を確保するため、Exception から派生していないオブジェクトは、共通言語ランタイム (CLR) により RuntimeWrappedException オブジェクトにラップされます。
RuntimeCompatibilityAttribute クラスを使用すると、例外をアセンブリの catch ブロックや例外フィルタ内にラップするどうかを指定できます。Microsoft C# や Visual Basic などのコンパイラでは、既定でこの属性を適用して、ラップの動作を指定します。
RuntimeCompatibilityAttribute クラスで例外がラップされないように指定したとしても、ランタイムによって例外がラップされる点に注意してください。この場合、例外がラップされないのは、catch ブロックと例外フィルタの中だけです。


System.Attribute
System.Runtime.CompilerServices.RuntimeCompatibilityAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- RuntimeCompatibilityAttribute クラスのページへのリンク