From 73056b1b02f3e1341b293fa2d6f3109fa3f000d9 Mon Sep 17 00:00:00 2001
From: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Date: Wed, 4 Jun 2025 14:40:07 -0700
Subject: [PATCH 1/2] Delete C++ snippets from System.Reflection (and
System.Numerics) (#11402)
---
.../Assembly.FullName/CPP/Example.cpp | 23 -
.../Assembly.GetExportedTypes/CPP/source.cpp | 78 -
.../Assembly.Load1/CPP/load1.cpp | 23 -
.../CPP/assemblybuilder_defineresource.cpp | 54 -
.../AssemblyBuilderClass/cpp/24895.cpp | 222 -
.../cpp/AssemblyBuilderClass.vcxproj | 147 -
.../cpp/snippets.5000.json | 3 -
...ssemblybuilder_defineunmanagedresource.cpp | 66 -
...semblybuilder_defineunmanagedresource2.cpp | 66 -
...emblybuilder_defineversioninforesource.cpp | 167 -
.../assemblybuilder_setcustomattribute1.cpp | 62 -
.../assemblybuilder_setcustomattribute2.cpp | 59 -
.../AssemblyClass/cpp/source.cpp | 75 -
.../AssemblyDelaySignAttribute/cpp/source.cpp | 13 -
.../AssemblyFlagsAttribute/CPP/source.cpp | 79 -
.../AssemblyName.Version/cpp/Example.cpp | 21 -
.../CPP/assemblyname_codebase.cpp | 99 -
.../CPP/assemblyname_constructor.cpp | 84 -
.../AssemblyName_Constructor_2/CPP/source.cpp | 24 -
.../CPP/assemblyname_getassemblyname.cpp | 30 -
.../CPP/assemblyname_keypair.cpp | 123 -
.../CPP/assemblyname_setpublickey.cpp | 125 -
.../VS_Snippets_CLR/Binder_1/CPP/binder.cpp | 449 -
.../BindingFlags/CPP/bindingflagssample.cpp | 365 -
.../CPP/constructorbuilder_attributes_4.cpp | 155 -
.../CPP/constructorbuilder_getmodule_4.cpp | 127 -
.../CPP/constructorbuilder_name_5.cpp | 123 -
...constructorbuilder_setcustomattribute1.cpp | 91 -
...constructorbuilder_setcustomattribute2.cpp | 86 -
...structorbuilder_setimplementationflags.cpp | 128 -
...nstructorbuilder_setsymcustomattribute.cpp | 106 -
.../CustomAttributeData/CPP/source.cpp | 234 -
.../Emit.ArgIterator/cpp/source.cpp | 111 -
.../EmitGenericType/CPP/source.cpp | 300 -
.../CPP/enumbuilder_properties_4.cpp | 87 -
.../CPP/enumbuilder_properties_5.cpp | 92 -
.../CPP/enumbuilder_setcustomattribute1.cpp | 107 -
.../CPP/enumbuilder_setcustomattribute2.cpp | 93 -
.../VS_Snippets_CLR/EventArg/CPP/eventarg.cpp | 29 -
.../CPP/fieldbuilder_reflectedtype.cpp | 84 -
.../CPP/fieldbuilder_setcustomattributes.cpp | 132 -
.../CPP/fieldbuilder_setoffset.cpp | 74 -
.../FieldInfo/CPP/fieldinfo.cpp | 34 -
.../CPP/fieldinfo_fieldhandle.cpp | 50 -
.../CPP/fieldinfo_getfieldfromhandle.cpp | 36 -
.../CPP/fieldinfo_getvalue.cpp | 40 -
.../CPP/fieldinfo_isnotserialized.cpp | 34 -
.../CPP/fieldinfo_ispinvokeimpl.cpp | 29 -
.../CPP/fieldinfo_isprivate.cpp | 53 -
.../CPP/fieldinfo_isspecialname.cpp | 34 -
.../CPP/fieldinfo_setvalue.cpp | 51 -
.../GenericMethodBuilder/cpp/source.cpp | 114 -
.../GetFldVal/CPP/getfldval.cpp | 22 -
.../CPP/ilgenerator_beginfaultblock.cpp | 102 -
.../CPP/ILGenerator_BeginFinallyBlock_2.cpp | 114 -
.../CPP/ilgenerator_begin_endscope.cpp | 97 -
.../IndentedTextWriterExample/CPP/form1.cpp | 120 -
.../CPP/localbuilder_sample_4.cpp | 92 -
.../cpp/source.cpp | 71 -
...emberinfo_getcustomattribute_isdefined.cpp | 68 -
.../CPP/memberinfo_getcustomattributes1.cpp | 67 -
.../VS_Snippets_CLR/MethodBody/cpp/source.cpp | 157 -
.../cpp/source.cpp | 41 -
.../CPP/methodbuilderclass.cpp | 67 -
.../MethodInfo.Generics/cpp/source.cpp | 132 -
.../ModuleBuilder_Class/CPP/modulebuilder.cpp | 80 -
.../modulebuilder_createglobalfunctions.cpp | 79 -
.../CPP/modulebuilder_defineenum.cpp | 46 -
.../modulebuilder_defineinitializeddata.cpp | 67 -
.../modulebuilder_definepinvokemethod1.cpp | 68 -
.../CPP/modulebuilder_defineresource1.cpp | 50 -
.../CPP/modulebuilder_defineresource2.cpp | 50 -
.../CPP/modulebuilder_getarraymethod.cpp | 110 -
.../CPP/parameterinfo_attributes1.cpp | 38 -
...meterInfo_GetCustomAttribute_IsDefined.cpp | 87 -
.../CPP/source.cpp | 82 -
.../ParameterInfo_IsIn_IsOut_IsOptional.cpp | 103 -
.../CPP/propertybuilder_setgetmethod_4.cpp | 130 -
.../PropertyInfo.SetValue/cpp/Example.cpp | 132 -
.../PropertyInfo.SetValue/cpp/example2.cpp | 65 -
.../cpp/source.cpp | 253 -
.../cpp/source.cpp | 81 -
.../Reflection/CPP/reflection.cpp | 172 -
.../cpp/strongnamekeypairx.cpp | 49 -
.../cpp/source.cpp | 104 -
.../typebuilder_adddeclarativesecurity.cpp | 47 -
.../CPP/typebuilder_definenestedtype1.cpp | 94 -
.../cpp/100656_fix.cpp | 64 -
.../typebuilder_defineuninitializeddata.cpp | 98 -
.../CPP/typebuilder_getevents1.cpp | 64 -
.../CPP/typebuilder_properties.cpp | 66 -
.../CPP/typebuilder_sample_4.cpp | 103 -
.../CPP/type_getconstructor3.cpp | 50 -
.../CPP/type_getdefaultmembers.cpp | 58 -
.../type_getevent1/CPP/type_getevent1.cpp | 44 -
.../CPP/source.cpp | 75 -
.../classic Array Example/CPP/source.cpp | 74 -
.../classic Array Example/CPP/source3.cpp | 68 -
.../CPP/source.cpp | 80 -
.../CPP/source.cpp | 72 -
.../CPP/source.cpp | 67 -
.../CPP/source2.cpp | 61 -
.../CPP/source.cpp | 46 -
.../CPP/source.cpp | 48 -
.../CPP/source.cpp | 53 -
.../CPP/source.cpp | 77 -
.../CPP/source.cpp | 63 -
.../CPP/source.cpp | 51 -
.../CPP/source.cpp | 68 -
.../CPP/source.cpp | 61 -
.../CPP/source.cpp | 61 -
.../CPP/source.cpp | 15 -
.../CPP/source.cpp | 32 -
.../CPP/source.cpp | 80 -
.../CPP/source.cpp | 41 -
.../classic Delegate Example/CPP/source.cpp | 63 -
.../CPP/source.cpp | 30 -
.../CPP/source.cpp | 62 -
.../CPP/source.cpp | 46 -
.../CPP/source.cpp | 50 -
.../CPP/source.cpp | 83 -
.../CPP/source.cpp | 78 -
.../CPP/source.cpp | 87 -
.../CPP/source.cpp | 47 -
.../CPP/source.cpp | 17 -
.../classic Math.Round Example/CPP/source.cpp | 12 -
.../CPP/source.cpp | 20 -
.../CPP/source.cpp | 24 -
.../CPP/source.cpp | 28 -
.../CPP/source.cpp | 27 -
.../CPP/source.cpp | 55 -
.../CPP/source.cpp | 54 -
.../CPP/source.cpp | 53 -
.../CPP/source.cpp | 31 -
.../CPP/source.cpp | 53 -
.../CPP/source.cpp | 37 -
.../CPP/source.cpp | 18 -
.../CPP/source.cpp | 60 -
.../CPP/source.cpp | 19 -
.../CPP/source.cpp | 73 -
.../CPP/source.cpp | 20 -
.../CPP/source.cpp | 19 -
.../CPP/source.cpp | 22 -
.../CPP/source.cpp | 36 -
.../CPP/source.cpp | 52 -
.../CPP/source.cpp | 53 -
.../CPP/source.cpp | 52 -
.../CPP/source.cpp | 161 -
.../CPP/source.cpp | 85 -
.../CPP/source.cpp | 92 -
.../CPP/source.cpp | 59 -
.../CPP/source.cpp | 92 -
.../CPP/source.cpp | 55 -
.../CPP/source.cpp | 18 -
.../CPP/source.cpp | 67 -
.../CPP/source.cpp | 29 -
.../CPP/source.cpp | 16 -
.../CPP/source.cpp | 15 -
.../CPP/source.cpp | 20 -
.../CPP/source.cpp | 19 -
.../CPP/source.cpp | 26 -
.../CPP/source.cpp | 17 -
.../CPP/source.cpp | 26 -
.../CPP/source1.cpp | 26 -
.../CPP/source2.cpp | 25 -
.../CPP/source.cpp | 37 -
.../CPP/source.cpp | 70 -
.../CPP/source.cpp | 15 -
.../cpp/source.cpp | 64 -
.../CPP/source.cpp | 21 -
.../cpp/source.cpp | 54 -
.../cpp/equals.cpp | 76 -
.../cpp/equals2.cpp | 43 -
.../CPP/source.cpp | 56 -
.../CPP/GetAssembly1.cpp | 19 -
.../CPP/assembly.cpp | 182 -
.../CPP/codebase1.cpp | 16 -
.../CPP/getcallingassembly1.cpp | 18 -
.../CPP/source.cpp | 137 -
.../CPP/source.cpp | 65 -
.../CPP/source.cpp | 71 -
.../CPP/source.cpp | 236 -
.../CPP/source.cpp | 150 -
.../CPP/source.cpp | 118 -
.../CPP/source.cpp | 89 -
.../CPP/source.cpp | 42 -
.../CPP/source.cpp | 116 -
.../CPP/source.cpp | 159 -
.../CPP/source.cpp | 81 -
.../CPP/source.cpp | 105 -
.../CPP/source.cpp | 33 -
.../CPP/source3.cpp | 34 -
.../CPP/source4.cpp | 29 -
.../CPP/source.cpp | 31 -
.../CPP/source.cpp | 28 -
.../CPP/source2.cpp | 28 -
.../CPP/source.cpp | 27 -
.../CPP/source.cpp | 90 -
.../CPP/source.cpp | 107 -
.../CPP/nestedenum.cpp | 121 -
.../cpp/source.cpp | 32 -
.../cpp/hide.cpp | 90 -
.../CPP/class1.cpp | 17 -
.../CPP/class1.cpp | 30 -
.../CPP/class1.cpp | 32 -
.../CPP/class1.cpp | 16 -
.../CPP/class1.cpp | 51 -
.../CPP/class1.cpp | 52 -
.../CPP/class1.cpp | 25 -
.../CPP/class1.cpp | 25 -
.../CPP/class1.cpp | 25 -
.../CPP/class1.cpp | 44 -
.../CPP/class1.cpp | 16 -
.../CPP/class1.cpp | 16 -
.../CPP/source.cpp | 126 -
.../cpp/source.cpp | 37 -
.../cpp/source.cpp | 32 -
.../cpp/source.cpp | 48 -
.../cpp/source.cpp | 39 -
.../cpp/getexecutingassembly1.cpp | 32 -
.../cpp/remarks.cpp | 43 -
.../cpp/remarks.cpp | 32 -
.../cpp/source.cpp | 46 -
.../XPathValidation/CPP/XPathValidation.cpp | 68 -
.../CPP/docresolver.cpp | 27 -
.../CPP/valid_xsd2.cpp | 64 -
.../CPP/readdefattr.cpp | 31 -
.../CPP/schematype.cpp | 51 -
.../CPP/vrdr_resolver.cpp | 59 -
.../Classic Uri Example/CPP/source.cpp | 34 -
.../CPP/source.cpp | 30 -
.../CPP/source.cpp | 20 -
.../CPP/source.cpp | 20 -
.../CPP/source.cpp | 18 -
.../Classic Uri.Host Example/CPP/source.cpp | 20 -
.../CPP/source.cpp | 29 -
.../Classic Uri.Port Example/CPP/source.cpp | 20 -
.../Classic Uri.Scheme Example/CPP/source.cpp | 20 -
.../Classic Uri.Uri Example/CPP/source.cpp | 18 -
.../Classic Uri.Uri1 Example/CPP/source.cpp | 18 -
.../Classic Uri.Uri3 Example/CPP/source.cpp | 20 -
.../Classic Uri.Uri4 Example/CPP/source.cpp | 12 -
.../CPP/source.cpp | 21 -
.../CPP/source.cpp | 18 -
.../CPP/source.cpp | 18 -
.../CPP/source.cpp | 18 -
.../CPP/source.cpp | 18 -
.../CPP/httpwebrequest_begingetresponse.cpp | 158 -
.../CPP/nclurienhancements.cpp | 150 -
.../NCLUriExamples/CPP/uriexamples.cpp | 271 -
.../SerializationAttributes/CPP/s.cpp | 77 -
.../UriBuilderSample/cpp/main.cpp | 27 -
.../CPP/source.cpp | 69 -
.../CPP/source.cpp | 40 -
.../CPP/source.cpp | 34 -
xml/System.Numerics/BigInteger.xml | 3 -
.../AssemblyBuilder.xml | 15 -
.../ConstructorBuilder.xml | 14 -
.../CustomAttributeBuilder.xml | 1 -
xml/System.Reflection.Emit/DynamicMethod.xml | 18 -
xml/System.Reflection.Emit/EnumBuilder.xml | 12 -
xml/System.Reflection.Emit/FieldBuilder.xml | 6 -
.../GenericTypeParameterBuilder.xml | 8 -
xml/System.Reflection.Emit/ILGenerator.xml | 19 -
xml/System.Reflection.Emit/LocalBuilder.xml | 4 -
xml/System.Reflection.Emit/MethodBuilder.xml | 19 -
xml/System.Reflection.Emit/MethodRental.xml | 59 +-
xml/System.Reflection.Emit/ModuleBuilder.xml | 20 -
xml/System.Reflection.Emit/OpCodes.xml | 12057 ++++++++--------
.../ParameterBuilder.xml | 1 -
.../PropertyBuilder.xml | 3 -
xml/System.Reflection.Emit/TypeBuilder.xml | 21 -
.../AmbiguousMatchException.xml | 1 -
xml/System.Reflection/Assembly.xml | 13 -
.../AssemblyCompanyAttribute.xml | 13 +-
.../AssemblyCopyrightAttribute.xml | 13 +-
.../AssemblyDelaySignAttribute.xml | 1 -
.../AssemblyFlagsAttribute.xml | 3 -
.../AssemblyKeyFileAttribute.xml | 1 -
xml/System.Reflection/AssemblyName.xml | 18 -
.../AssemblyTitleAttribute.xml | 47 +-
xml/System.Reflection/Binder.xml | 177 +-
xml/System.Reflection/BindingFlags.xml | 181 +-
xml/System.Reflection/CallingConventions.xml | 19 +-
xml/System.Reflection/ConstructorInfo.xml | 2 -
xml/System.Reflection/CustomAttributeData.xml | 8 -
.../CustomAttributeNamedArgument.xml | 2 -
.../CustomAttributeTypedArgument.xml | 3 -
.../DefaultMemberAttribute.xml | 37 +-
xml/System.Reflection/EventAttributes.xml | 27 +-
xml/System.Reflection/EventInfo.xml | 2 -
.../ExceptionHandlingClause.xml | 280 +-
.../ExceptionHandlingClauseOptions.xml | 36 +-
xml/System.Reflection/FieldAttributes.xml | 36 +-
xml/System.Reflection/FieldInfo.xml | 20 -
.../GenericParameterAttributes.xml | 23 +-
xml/System.Reflection/IReflect.xml | 109 +-
xml/System.Reflection/LocalVariableInfo.xml | 70 +-
xml/System.Reflection/MemberInfo.xml | 7 -
xml/System.Reflection/MemberTypes.xml | 83 +-
xml/System.Reflection/MethodAttributes.xml | 13 +-
xml/System.Reflection/MethodBase.xml | 16 -
xml/System.Reflection/MethodBody.xml | 211 +-
xml/System.Reflection/MethodInfo.xml | 7 -
xml/System.Reflection/Module.xml | 15 -
xml/System.Reflection/ParameterAttributes.xml | 27 +-
xml/System.Reflection/ParameterInfo.xml | 9 -
xml/System.Reflection/ParameterModifier.xml | 33 +-
xml/System.Reflection/PropertyAttributes.xml | 27 +-
xml/System.Reflection/PropertyInfo.xml | 10 -
xml/System.Reflection/StrongNameKeyPair.xml | 33 +-
311 files changed, 6770 insertions(+), 24312 deletions(-)
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp
delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp
delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp
diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp
deleted file mode 100644
index 54654202f49..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- Console::WriteLine("The FullName property (also called the display name) of...");
- Console::WriteLine("...the currently executing assembly:");
- Console::WriteLine(Assembly::GetExecutingAssembly()->FullName);
-
- Console::WriteLine("...the assembly that contains the Int32 type:");
- Console::WriteLine(int::typeid->Assembly->FullName);
-}
-
-/* This example produces output similar to the following:
-
-The FullName property (also called the display name) of...
-...the currently executing assembly:
-ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-...the assembly that contains the Int32 type:
-mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp
deleted file mode 100644
index 85c7081e152..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace ExportedClassExample
-{
- public ref class Example sealed
- {
- private:
- Example()
- {
- }
-
- public:
- void static EnumerateExportedTypes()
- {
- for each (Type^ exportedType in
- Example::typeid->Assembly->GetExportedTypes())
- {
- Console::WriteLine(exportedType);
- }
- }
- };
-
- public ref class PublicClass
- {
- public:
- ref class PublicNestedClass
- {
- };
-
- protected:
- ref class ProtectedNestedClass
- {
- };
-
- internal:
- ref class FriendNestedClass
- {
- };
-
- private:
- ref class PrivateNestedClass
- {
- };
- };
-
- ref class FriendClass
- {
- public:
- ref class PublicNestedClass
- {
- };
-
- protected:
- ref class ProtectedNestedClass
- {
- };
-
- internal:
- ref class FriendNestedClass
- {
- };
-
- private:
- ref class PrivateNestedClass
- {
- };
- };
-}
-
-int main()
-{
- ExportedClassExample::Example::EnumerateExportedTypes();
-
- return 0;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp
deleted file mode 100644
index 8735dfb6dac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Reflection;
-int main()
-{
- // You must supply a valid fully qualified assembly name.
- Assembly^ SampleAssembly = Assembly::Load
- ( "SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3" );
- array^ Types = SampleAssembly->GetTypes();
-
- // Display all the types contained in the specified assembly.
- IEnumerator^ myEnum = Types->GetEnumerator();
- Type^ oType;
- while ( myEnum->MoveNext() )
- {
- oType = safe_cast(myEnum->Current);
- Console::WriteLine( oType->Name );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp
deleted file mode 100644
index d5ff911a579..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-//
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Resources;
-
-/*
- The following program demonstrates the 'DefineResource' and 'DefineVersionInfoResource'
- methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime.
- The unmanaged version information like product, product version, Company, Copyright,
- trademark are defined with 'DefineVersionInfoResource' method.
-*/
-static Type^ CreateAssembly( AppDomain^ appDomain );
-
-int main()
-{
- AssemblyBuilder^ myAssembly;
- IResourceWriter^ myResourceWriter;
- myAssembly = safe_cast(CreateAssembly( Thread::GetDomain() )->Assembly);
- myResourceWriter = myAssembly->DefineResource( "myResourceFile", "A sample Resource File", "MyEmitAssembly.MyResource.resources" );
- myResourceWriter->AddResource( "AddResource 1", "First added resource" );
- myResourceWriter->AddResource( "AddResource 2", "Second added resource" );
- myResourceWriter->AddResource( "AddResource 3", "Third added resource" );
- myAssembly->DefineVersionInfoResource( "AssemblySample", "2:0:0:1", "Microsoft Corporation", "@Copyright Microsoft Corp. 1990-2001", ".NET is a trademark of Microsoft Corporation" );
- myAssembly->Save( "MyEmitAssembly.dll" );
-}
-
-// Create the callee transient dynamic assembly.
-static Type^ CreateAssembly( AppDomain^ appDomain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "MyEmitAssembly";
- AssemblyBuilder^ myAssembly = appDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
-
- // Define a public class named "HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define the Display method.
- MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr );
-
- // Generate IL for GetGreeting.
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldstr, "Display method get called." );
- methodIL->Emit( OpCodes::Ret );
-
- // Returns the type HelloWorld.
- return (helloWorldClass->CreateType());
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp
deleted file mode 100644
index 28daac1e840..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-void main()
-{
- // This code creates an assembly that contains one type,
- // named "MyDynamicType", that has a private field, a property
- // that gets and sets the private field, constructors that
- // initialize the private field, and a method that multiplies
- // a user-supplied number by the private field value and returns
- // the result. In Visual C++ the type might look like this:
- /*
- public ref class MyDynamicType
- {
- private:
- int m_number;
-
- public:
- MyDynamicType() : m_number(42) {};
- MyDynamicType(int initNumber) : m_number(initNumber) {};
-
- property int Number
- {
- int get() { return m_number; }
- void set(int value) { m_number = value; }
- }
-
- int MyMethod(int multiplier)
- {
- return m_number * multiplier;
- }
- };
- */
-
- AssemblyName^ aName = gcnew AssemblyName("DynamicAssemblyExample");
- AssemblyBuilder^ ab =
- AssemblyBuilder::DefineDynamicAssembly(
- aName,
- AssemblyBuilderAccess::Run);
-
- // The module name is usually the same as the assembly name
- ModuleBuilder^ mb =
- ab->DefineDynamicModule(aName->Name);
-
- TypeBuilder^ tb = mb->DefineType(
- "MyDynamicType",
- TypeAttributes::Public);
-
- // Add a private field of type int (Int32).
- FieldBuilder^ fbNumber = tb->DefineField(
- "m_number",
- int::typeid,
- FieldAttributes::Private);
-
- // Define a constructor that takes an integer argument and
- // stores it in the private field.
- array^ parameterTypes = { int::typeid };
- ConstructorBuilder^ ctor1 = tb->DefineConstructor(
- MethodAttributes::Public,
- CallingConventions::Standard,
- parameterTypes);
-
- ILGenerator^ ctor1IL = ctor1->GetILGenerator();
- // For a constructor, argument zero is a reference to the new
- // instance. Push it on the stack before calling the base
- // class constructor. Specify the default constructor of the
- // base class (System::Object) by passing an empty array of
- // types (Type::EmptyTypes) to GetConstructor.
- ctor1IL->Emit(OpCodes::Ldarg_0);
- ctor1IL->Emit(OpCodes::Call,
- Object::typeid->GetConstructor(Type::EmptyTypes));
- // Push the instance on the stack before pushing the argument
- // that is to be assigned to the private field m_number.
- ctor1IL->Emit(OpCodes::Ldarg_0);
- ctor1IL->Emit(OpCodes::Ldarg_1);
- ctor1IL->Emit(OpCodes::Stfld, fbNumber);
- ctor1IL->Emit(OpCodes::Ret);
-
- // Define a default constructor that supplies a default value
- // for the private field. For parameter types, pass the empty
- // array of types or pass nullptr.
- ConstructorBuilder^ ctor0 = tb->DefineConstructor(
- MethodAttributes::Public,
- CallingConventions::Standard,
- Type::EmptyTypes);
-
- ILGenerator^ ctor0IL = ctor0->GetILGenerator();
- ctor0IL->Emit(OpCodes::Ldarg_0);
- ctor0IL->Emit(OpCodes::Call,
- Object::typeid->GetConstructor(Type::EmptyTypes));
- // For a constructor, argument zero is a reference to the new
- // instance. Push it on the stack before pushing the default
- // value on the stack.
- ctor0IL->Emit(OpCodes::Ldarg_0);
- ctor0IL->Emit(OpCodes::Ldc_I4_S, 42);
- ctor0IL->Emit(OpCodes::Stfld, fbNumber);
- ctor0IL->Emit(OpCodes::Ret);
-
- // Define a property named Number that gets and sets the private
- // field.
- //
- // The last argument of DefineProperty is nullptr, because the
- // property has no parameters. (If you don't specify nullptr, you must
- // specify an array of Type objects. For a parameterless property,
- // use the built-in array with no elements: Type::EmptyTypes)
- PropertyBuilder^ pbNumber = tb->DefineProperty(
- "Number",
- PropertyAttributes::HasDefault,
- int::typeid,
- nullptr);
-
- // The property "set" and property "get" methods require a special
- // set of attributes.
- MethodAttributes getSetAttr = MethodAttributes::Public |
- MethodAttributes::SpecialName | MethodAttributes::HideBySig;
-
- // Define the "get" accessor method for Number. The method returns
- // an integer and has no arguments. (Note that nullptr could be
- // used instead of Types::EmptyTypes)
- MethodBuilder^ mbNumberGetAccessor = tb->DefineMethod(
- "get_Number",
- getSetAttr,
- int::typeid,
- Type::EmptyTypes);
-
- ILGenerator^ numberGetIL = mbNumberGetAccessor->GetILGenerator();
- // For an instance property, argument zero is the instance. Load the
- // instance, then load the private field and return, leaving the
- // field value on the stack.
- numberGetIL->Emit(OpCodes::Ldarg_0);
- numberGetIL->Emit(OpCodes::Ldfld, fbNumber);
- numberGetIL->Emit(OpCodes::Ret);
-
- // Define the "set" accessor method for Number, which has no return
- // type and takes one argument of type int (Int32).
- MethodBuilder^ mbNumberSetAccessor = tb->DefineMethod(
- "set_Number",
- getSetAttr,
- nullptr,
- gcnew array { int::typeid });
-
- ILGenerator^ numberSetIL = mbNumberSetAccessor->GetILGenerator();
- // Load the instance and then the numeric argument, then store the
- // argument in the field.
- numberSetIL->Emit(OpCodes::Ldarg_0);
- numberSetIL->Emit(OpCodes::Ldarg_1);
- numberSetIL->Emit(OpCodes::Stfld, fbNumber);
- numberSetIL->Emit(OpCodes::Ret);
-
- // Last, map the "get" and "set" accessor methods to the
- // PropertyBuilder. The property is now complete.
- pbNumber->SetGetMethod(mbNumberGetAccessor);
- pbNumber->SetSetMethod(mbNumberSetAccessor);
-
- // Define a method that accepts an integer argument and returns
- // the product of that integer and the private field m_number. This
- // time, the array of parameter types is created on the fly.
- MethodBuilder^ meth = tb->DefineMethod(
- "MyMethod",
- MethodAttributes::Public,
- int::typeid,
- gcnew array { int::typeid });
-
- ILGenerator^ methIL = meth->GetILGenerator();
- // To retrieve the private instance field, load the instance it
- // belongs to (argument zero). After loading the field, load the
- // argument one and then multiply. Return from the method with
- // the return value (the product of the two numbers) on the
- // execution stack.
- methIL->Emit(OpCodes::Ldarg_0);
- methIL->Emit(OpCodes::Ldfld, fbNumber);
- methIL->Emit(OpCodes::Ldarg_1);
- methIL->Emit(OpCodes::Mul);
- methIL->Emit(OpCodes::Ret);
-
- // Finish the type->
- Type^ t = tb->CreateType();
-
- // Because AssemblyBuilderAccess includes Run, the code can be
- // executed immediately. Start by getting reflection objects for
- // the method and the property.
- MethodInfo^ mi = t->GetMethod("MyMethod");
- PropertyInfo^ pi = t->GetProperty("Number");
-
- // Create an instance of MyDynamicType using the default
- // constructor.
- Object^ o1 = Activator::CreateInstance(t);
-
- // Display the value of the property, then change it to 127 and
- // display it again. Use nullptr to indicate that the property
- // has no index.
- Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr));
- pi->SetValue(o1, 127, nullptr);
- Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr));
-
- // Call MyMethod, passing 22, and display the return value, 22
- // times 127. Arguments must be passed as an array, even when
- // there is only one.
- array
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj
deleted file mode 100644
index f0b6e04f882..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {2C2BE6AE-166F-4B41-8A58-5A6088ED4869}
- v4.7.2
- ManagedCProj
- AssemblyBuilderClass
- 10.0.17134.0
-
-
-
- Application
- true
- v141
- true
- Unicode
-
-
- Application
- false
- v141
- true
- Unicode
-
-
- Application
- true
- v141
- true
- Unicode
-
-
- Application
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
-
- NotUsing
- Level3
- Disabled
- WIN32;_DEBUG;%(PreprocessorDefinitions)
-
-
-
- Console
-
-
-
-
- NotUsing
- Level3
- Disabled
- _DEBUG;%(PreprocessorDefinitions)
-
-
-
- Console
-
-
-
-
- NotUsing
- Level3
- WIN32;NDEBUG;%(PreprocessorDefinitions)
-
-
-
- Console
-
-
-
-
- NotUsing
- Level3
- NDEBUG;%(PreprocessorDefinitions)
-
-
-
- Console
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json
deleted file mode 100644
index da9ebf8da2f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "host": "visualstudio"
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp
deleted file mode 100644
index be95d74e2dc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-//
-/*
- The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource'
- methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime.
- An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file
- calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console.
-*/
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Resources;
-
- static AssemblyBuilder^ CreateAssembly( String^ name )
- {
- AssemblyName^ aName = gcnew AssemblyName(name);
- AssemblyBuilder^ myAssembly =
- AppDomain::CurrentDomain->DefineDynamicAssembly( aName,
- AssemblyBuilderAccess::Save );
-
- // Define a dynamic module.
- ModuleBuilder^ myModule =
- myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" );
-
- // Define a public class named "EmitClass" in the assembly.
- TypeBuilder^ myEmitClass =
- myModule->DefineType( "EmitClass", TypeAttributes::Public );
-
- // Define the Display method.
- MethodBuilder^ myMethod =
- myEmitClass->DefineMethod( "Display", MethodAttributes::Public,
- String::typeid, nullptr );
-
- // Generate IL for Display method.
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldstr, "Display method gets called." );
- methodIL->Emit( OpCodes::Ret );
-
- myEmitClass->CreateType();
-
- return (myAssembly);
- };
-
- //
- //
- void main()
- {
- AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly");
-
- // Defines a standalone managed resource for this assembly.
- IResourceWriter^ myResourceWriter =
- myAssembly->DefineResource( "myResourceFile", "A sample Resource File",
- "MyAssemblyResource.resources", ResourceAttributes::Private );
-
- myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" );
-
- myAssembly->Save(myAssembly->GetName()->Name + ".dll" );
-
- // Defines an unmanaged resource file for this assembly.
- myAssembly->DefineUnmanagedResource( "MyAssemblyResource.resources" );
- };
-
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp
deleted file mode 100644
index 6f099f1d8c4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-//
-/*
- The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource'
- methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime.
- An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file
- calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console.
-*/
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Resources;
-
- static AssemblyBuilder^ CreateAssembly( String^ name )
- {
- AssemblyName^ aName = gcnew AssemblyName(name);
- AssemblyBuilder^ myAssembly =
- AppDomain::CurrentDomain->DefineDynamicAssembly( aName,
- AssemblyBuilderAccess::Save );
-
- // Define a dynamic module.
- ModuleBuilder^ myModule =
- myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" );
-
- // Define a public class named "EmitClass" in the assembly.
- TypeBuilder^ myEmitClass =
- myModule->DefineType( "EmitClass", TypeAttributes::Public );
-
- // Define the Display method.
- MethodBuilder^ myMethod =
- myEmitClass->DefineMethod( "Display", MethodAttributes::Public,
- String::typeid, nullptr );
-
- // Generate IL for Display method.
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldstr, "Display method gets called." );
- methodIL->Emit( OpCodes::Ret );
-
- myEmitClass->CreateType();
-
- return (myAssembly);
- };
-
- //
- //
- void main()
- {
- AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly");
-
- // Defines a standalone managed resource for this assembly.
- IResourceWriter^ myResourceWriter =
- myAssembly->DefineResource( "myResourceFile", "A sample Resource File",
- "MyAssemblyResource.resources", ResourceAttributes::Private );
-
- myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" );
-
- myAssembly->Save(myAssembly->GetName()->Name + ".dll" );
-
- // Defines an unmanaged resource file for this assembly.
- myAssembly->DefineUnmanagedResource( gcnew array{01, 00, 01} );
- };
-
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp
deleted file mode 100644
index 8b17c3f5d4f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-// System::Reflection::Emit::AssemblyBuilder.DefineVersionInfoResource()
-
-// This code example shows how to use the AssemblyBuilder::DefineVersionInfoResource method
-// to add Windows version information to a dynamic assembly. The code example builds an
-// assembly with one module and no types. Several attributes are applied to the assembly,
-// DefineVersionInfoResource is used to create the Windows version information resource,
-// and then the assembly is saved as EmittedAssembly.exe. The Windows Explorer can be used
-// to examine the version information for the assembly.
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-
-/*
-// Create the callee transient dynamic assembly.
-static Type^ CreateAssembly( AppDomain^ myDomain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "MyEmittedAssembly";
- AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );
-
- // Set Company Attribute to the assembly.
- Type^ companyAttribute = AssemblyCompanyAttribute::typeid;
- array^types1 = {String::typeid};
- ConstructorInfo^ myConstructorInfo1 = companyAttribute->GetConstructor( types1 );
- array^obj1 = {"Microsoft Corporation"};
- CustomAttributeBuilder^ attributeBuilder1 = gcnew CustomAttributeBuilder( myConstructorInfo1,obj1 );
- myAssembly->SetCustomAttribute( attributeBuilder1 );
-
- // Set Copyright Attribute to the assembly.
- Type^ copyrightAttribute = AssemblyCopyrightAttribute::typeid;
- array^types2 = {String::typeid};
- ConstructorInfo^ myConstructorInfo2 = copyrightAttribute->GetConstructor( types2 );
- array^obj2 = {"@Copyright Microsoft Corp. 1990-2001"};
- CustomAttributeBuilder^ attributeBuilder2 = gcnew CustomAttributeBuilder( myConstructorInfo2,obj2 );
- myAssembly->SetCustomAttribute( attributeBuilder2 );
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
-
- // Define a public class named S"HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define the Display method.
- MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr );
-
- // Generate IL for GetGreeting.
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldstr, "Display method get called." );
- methodIL->Emit( OpCodes::Ret );
-
- // Returns the type HelloWorld.
- return (helloWorldClass->CreateType());
-}
-*/
-
-int main()
-{
- AssemblyName^ assemName = gcnew AssemblyName();
- assemName->Name = "EmittedAssembly";
-
- // Create a dynamic assembly in the current application domain,
- // specifying that the assembly is to be saved.
- //
- AssemblyBuilder^ myAssembly =
- AppDomain::CurrentDomain->DefineDynamicAssembly(assemName,
- AssemblyBuilderAccess::Save);
-
-
- // To apply an attribute to a dynamic assembly, first get the
- // attribute type. The AssemblyFileVersionAttribute sets the
- // File Version field on the Version tab of the Windows file
- // properties dialog.
- //
- Type^ attributeType = AssemblyFileVersionAttribute::typeid;
-
- // To identify the constructor, use an array of types representing
- // the constructor's parameter types. This ctor takes a string.
- //
- array^ ctorParameters = { String::typeid };
-
- // Get the constructor for the attribute.
- //
- ConstructorInfo^ ctor = attributeType->GetConstructor(ctorParameters);
-
- // Pass the constructor and an array of arguments (in this case,
- // an array containing a single string) to the
- // CustomAttributeBuilder constructor.
- //
- array^ ctorArgs = { "2.0.3033.0" };
- CustomAttributeBuilder^ attribute =
- gcnew CustomAttributeBuilder(ctor, ctorArgs);
-
- // Finally, apply the attribute to the assembly.
- //
- myAssembly->SetCustomAttribute(attribute);
-
-
- // The pattern described above is used to create and apply
- // several more attributes. As it happens, all these attributes
- // have a constructor that takes a string, so the same ctorArgs
- // variable works for all of them.
-
-
- // The AssemblyTitleAttribute sets the Description field on
- // the General tab and the Version tab of the Windows file
- // properties dialog.
- //
- attributeType = AssemblyTitleAttribute::typeid;
- ctor = attributeType->GetConstructor(ctorParameters);
- ctorArgs = gcnew array { "The Application Title" };
- attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs);
- myAssembly->SetCustomAttribute(attribute);
-
- // The AssemblyCopyrightAttribute sets the Copyright field on
- // the Version tab.
- //
- attributeType = AssemblyCopyrightAttribute::typeid;
- ctor = attributeType->GetConstructor(ctorParameters);
- ctorArgs = gcnew array { "� My Example Company 1991-2005" };
- attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs);
- myAssembly->SetCustomAttribute(attribute);
-
- // The AssemblyDescriptionAttribute sets the Comment item.
- //
- attributeType = AssemblyDescriptionAttribute::typeid;
- ctor = attributeType->GetConstructor(ctorParameters);
- attribute = gcnew CustomAttributeBuilder(ctor,
- gcnew array { "This is a comment." });
- myAssembly->SetCustomAttribute(attribute);
-
- // The AssemblyCompanyAttribute sets the Company item.
- //
- attributeType = AssemblyCompanyAttribute::typeid;
- ctor = attributeType->GetConstructor(ctorParameters);
- attribute = gcnew CustomAttributeBuilder(ctor,
- gcnew array { "My Example Company" });
- myAssembly->SetCustomAttribute(attribute);
-
- // The AssemblyProductAttribute sets the Product Name item.
- //
- attributeType = AssemblyProductAttribute::typeid;
- ctor = attributeType->GetConstructor(ctorParameters);
- attribute = gcnew CustomAttributeBuilder(ctor,
- gcnew array { "My Product Name" });
- myAssembly->SetCustomAttribute(attribute);
-
-
- // Define the assembly's only module. For a single-file assembly,
- // the module name is the assembly name.
- //
- ModuleBuilder^ myModule =
- myAssembly->DefineDynamicModule(assemName->Name,
- assemName->Name + ".exe");
-
- // No types or methods are created for this example.
-
-
- // Define the unmanaged version information resource, which
- // contains the attribute informaion applied earlier, and save
- // the assembly. Use the Windows Explorer to examine the properties
- // of the .exe file.
- //
- myAssembly->DefineVersionInfoResource();
- myAssembly->Save(assemName->Name + ".exe");
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp
deleted file mode 100644
index 668ee141f99..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-
-// System.Reflection.Emit.SetCustomAttribute(CustomAttributeBuilder)
-/*
-The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)'
-method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived
-from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute
-and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type
-and displays its contents to the console.
-*/
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-//
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- String^ s;
- int x;
- MyAttribute( String^ s, int x )
- {
- this->s = s;
- this->x = x;
- }
-};
-
-Type^ CreateCallee( AppDomain^ domain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
- AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
- Type^ myType = MyAttribute::typeid;
- array^temp0 = {String::typeid,int::typeid};
- ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 );
- array^temp1 = {"Hello",2};
- CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( infoConstructor,temp1 );
- myAssembly->SetCustomAttribute( attributeBuilder );
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
- return (helloWorldClass->CreateType());
-}
-
-int main()
-{
- Type^ customAttribute = CreateCallee( Thread::GetDomain() );
- array^attributes = customAttribute->Assembly->GetCustomAttributes( true );
- Console::WriteLine( "MyAttribute custom attribute contains : " );
- for ( int index = 0; index < attributes->Length; index++ )
- {
- if ( dynamic_cast(attributes[ index ]) )
- {
- Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s );
- Console::WriteLine( "x : {0}", (dynamic_cast(attributes[ index ]))->x );
- break;
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp
deleted file mode 100644
index 008090d756e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-// System.Reflection.Emit.SetCustomAttribute(ConstructorInfo, byte[])
-/*
-The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, byte[])'
-method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived
-from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute
-and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type
-and displays its contents to the console.
-*/
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- bool s;
- MyAttribute( bool s )
- {
- this->s = s;
- }
-};
-
-Type^ CreateCallee( AppDomain^ domain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
- AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
- Type^ myType = MyAttribute::typeid;
- array^temp0 = {bool::typeid};
- ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 );
- array^temp1 = {01,00,01};
- myAssembly->SetCustomAttribute( infoConstructor, temp1 );
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
- return (helloWorldClass->CreateType());
-}
-
-int main()
-{
- Type^ customAttribute = CreateCallee( Thread::GetDomain() );
- array^attributes = customAttribute->Assembly->GetCustomAttributes( true );
- Console::WriteLine( "MyAttribute custom attribute contains : " );
- for ( int index = 0; index < attributes->Length; index++ )
- {
- if ( dynamic_cast(attributes[ index ]) )
- {
- Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s );
- break;
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp
deleted file mode 100644
index 2384a6c6a11..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security::Permissions;
-
-[assembly:AssemblyVersionAttribute("1.0.2000.0")];
-
-public ref class Example
-{
-private:
- int factor;
-
-public:
- Example(int f)
- {
- factor = f;
- }
-
- int SampleMethod(int x)
- {
- Console::WriteLine("\nExample->SampleMethod({0}) executes.", x);
- return x * factor;
- }
-};
-
-void main()
-{
- Assembly^ assem = Example::typeid->Assembly;
-
- Console::WriteLine("Assembly Full Name:");
- Console::WriteLine(assem->FullName);
-
- // The AssemblyName type can be used to parse the full name.
- AssemblyName^ assemName = assem->GetName();
- Console::WriteLine("\nName: {0}", assemName->Name);
- Console::WriteLine("Version: {0}.{1}",
- assemName->Version->Major, assemName->Version->Minor);
-
- Console::WriteLine("\nAssembly CodeBase:");
- Console::WriteLine(assem->CodeBase);
-
- // Create an object from the assembly, passing in the correct number and
- // type of arguments for the constructor.
- Object^ o = assem->CreateInstance("Example", false,
- BindingFlags::ExactBinding,
- nullptr, gcnew array { 2 }, nullptr, nullptr);
-
- // Make a late-bound call to an instance method of the object.
- MethodInfo^ m = assem->GetType("Example")->GetMethod("SampleMethod");
- Object^ ret = m->Invoke(o, gcnew array { 42 });
- Console::WriteLine("SampleMethod returned {0}.", ret);
-
- Console::WriteLine("\nAssembly entry point:");
- Console::WriteLine(assem->EntryPoint);
-}
-
-/* This code example produces output similar to the following:
-
-Assembly Full Name:
-source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null
-
-Name: source
-Version: 1.0
-
-Assembly CodeBase:
-file:///C:/sdtree/AssemblyClass/cpp/source.exe
-
-Example->SampleMethod(42) executes.
-SampleMethod returned 84.
-
-Assembly entry point:
-UInt32 _mainCRTStartup()
- */
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp
deleted file mode 100644
index 9ec81948d79..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Per Kitg, from cut QuickStart (vswhidbey 160832)
-//
-using namespace System;
-using namespace System::Reflection;
-
-[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")];
-[assembly:AssemblyDelaySignAttribute(true)];
-
-namespace DelaySign
-{
- public ref class Test { };
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp
deleted file mode 100644
index 28ca23085e4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Specify a combination of AssemblyNameFlags for this
-// assembly.
-[assembly:AssemblyFlagsAttribute(
- AssemblyNameFlags::EnableJITcompileOptimizer
- | AssemblyNameFlags::Retargetable)];
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Get this assembly.
- Assembly^ thisAsm = Example::typeid->Assembly;
-
- // Get the AssemblyName for this assembly.
- AssemblyName^ thisAsmName = thisAsm->GetName( false );
-
- // Display the flags that were set for this assembly.
- ListFlags( thisAsmName->Flags );
-
- // Create an instance of AssemblyFlagsAttribute with the
- // same combination of flags that was specified for this
- // assembly. Note that PublicKey is included automatically
- // for the assembly, but not for this instance of
- // AssemblyFlagsAttribute.
- AssemblyFlagsAttribute^ afa = gcnew AssemblyFlagsAttribute(
- static_cast (AssemblyNameFlags::EnableJITcompileOptimizer
- | AssemblyNameFlags::Retargetable) );
-
- // Get the flags. The property returns an integer, so
- // the return value must be cast to AssemblyNameFlags.
- AssemblyNameFlags anf = static_cast(afa->AssemblyFlags);
-
- // Display the flags.
- Console::WriteLine();
- ListFlags( anf );
- }
-
-private:
- static void ListFlags( AssemblyNameFlags anf )
- {
- if ( anf == AssemblyNameFlags::None )
- {
- Console::WriteLine( L"AssemblyNameFlags.None" );
- }
- else
- {
- if ( 0 != static_cast(anf & AssemblyNameFlags::Retargetable) )
- Console::WriteLine( L"AssemblyNameFlags.Retargetable" );
- if ( 0 != static_cast(anf & AssemblyNameFlags::PublicKey) )
- Console::WriteLine( L"AssemblyNameFlags.PublicKey" );
- if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileOptimizer) )
- Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileOptimizer" );
- if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileTracking) )
- Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileTracking" );
- }
- }
-
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This code example produces the following output:
-
-AssemblyNameFlags.Retargetable
-AssemblyNameFlags.PublicKey
-AssemblyNameFlags.EnableJITcompileOptimizer
-
-AssemblyNameFlags.Retargetable
-AssemblyNameFlags.EnableJITcompileOptimizer
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp
deleted file mode 100644
index 7a72383a28c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-[assembly:AssemblyVersion("1.1.0.0")];
-
-void main()
-{
- Console::WriteLine("The version of the currently executing assembly is: {0}",
- Assembly::GetExecutingAssembly()->GetName()->Version);
-
- Console::WriteLine("The version of mscorlib.dll is: {0}",
- String::typeid->Assembly->GetName()->Version);
-}
-
-/* This example produces output similar to the following:
-
-The version of the currently executing assembly is: 1.1.0.0
-The version of mscorlib.dll is: 2.0.0.0
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp
deleted file mode 100644
index 1879b4dc9fd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-
-// System::Reflection::AssemblyName::CodeBase
-// System::Reflection::AssemblyName::CultureInfo
-// System::Reflection::AssemblyName::HashAlgorithm
-// System::Reflection::AssemblyName::FullName
-/*
- The following example demonstrates the 'CodeBase', 'CultureInfo'
- 'HashAlgorithm' and 'FullName' properties of the 'AssemblyName' class. Creates
- a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and
- a type within the module named 'MyType'. The type 'MyType' has a single
- method called 'Main' which is also the entry point to the assembly. The
- creation of the dynamic assembly is carried out by the method called
- 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly'
- the assemblies currently loaded are found and the dynamic assembly that we
- have created is searched for, which is displayed to the console. The dynamic
- assembly is also saved to a file named 'MyAssembly.exe'.
-
- Note : Run 'MyAssembly.exe' which this example has created for a simple
- 'Hello World!' display.
-*/
-//
-//
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Threading;
-using namespace System::IO;
-using namespace System::Globalization;
-using namespace System::Reflection::Emit;
-using namespace System::Configuration::Assemblies;
-static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName )
-{
- // Get the assembly builder from the application domain associated with the current thread.
- AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in the assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" );
-
- // Create a method called 'Main'.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr );
-
- // Get the Intermediate Language generator for the method.
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
-
- // Use the utility method to generate the IL instructions that print a String* to the console.
- myILGenerator->EmitWriteLine( "Hello World!" );
-
- // Generate the 'ret' IL instruction.
- myILGenerator->Emit( OpCodes::Ret );
-
- // End the creation of the type.
- myTypeBuilder->CreateType();
-
- // Set the method with name 'Main' as the entry point in the assembly.
- myAssemblyBuilder->SetEntryPoint( myMethodBuilder );
- myAssemblyBuilder->Save( fileName );
-}
-
-int main()
-{
- // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
-
- // Set the codebase to the physical directory were the assembly resides.
- myAssemblyName->CodeBase = Directory::GetCurrentDirectory();
-
- // Set the culture information of the assembly to 'English-American'.
- myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" );
-
- // Set the hash algorithm to 'SHA256'.
- myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256;
- myAssemblyName->Name = "MyAssembly";
- myAssemblyName->Version = gcnew Version( "1.0.0.2001" );
- MakeAssembly( myAssemblyName, "MyAssembly.exe" );
-
- // Get all the assemblies currently loaded in the application domain.
- array^myAssemblies = Thread::GetDomain()->GetAssemblies();
-
- // Get the dynamic assembly named 'MyAssembly'.
- Assembly^ myAssembly = nullptr;
- for ( int i = 0; i < myAssemblies->Length; i++ )
- {
- if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 )
- myAssembly = myAssemblies[ i ];
- }
- if ( myAssembly != nullptr )
- {
- Console::WriteLine( "\nDisplaying the full assembly name\n" );
- Console::WriteLine( myAssembly->GetName()->FullName );
- }
-}
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp
deleted file mode 100644
index 21eae3f4c19..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-
-// System::Reflection::AssemblyName::AssemblyName()
-// System::Reflection::AssemblyName::Name
-// System::Reflection::AssemblyName::Version
-/*
- The following example demonstrates the constructor 'AssemblyName()' and
- the 'Name' and 'Version' properties of the 'AssemblyName' class. Creates
- a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and
- a type within the module named 'MyType'. The type 'MyType' has a single
- method called 'Main' which is also the entry point to the assembly. The
- creation of the dynamic assembly is carried out by the method called
- 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly'
- the assemblies currently loaded are found and the dynamic assembly that we
- have created is searched for, which is displayed to the console. The dynamic
- assembly is also saved to a file named 'MyAssembly.exe'.
-
- Note : Run 'MyAssembly.exe' which this example has created for a simple
- 'Hello World!' display.
-*/
-//
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Threading;
-using namespace System::Reflection::Emit;
-static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName )
-{
- // Get the assembly builder from the application domain associated with the current thread.
- AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in the assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" );
-
- // Create a method called 'Main'.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr );
-
- // Get the Intermediate Language generator for the method.
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
-
- // Use the utility method to generate the IL instructions that print a String* to the console.
- myILGenerator->EmitWriteLine( "Hello World!" );
-
- // Generate the 'ret' IL instruction.
- myILGenerator->Emit( OpCodes::Ret );
-
- // End the creation of the type.
- myTypeBuilder->CreateType();
-
- // Set the method with name 'Main' as the entry point in the assembly.
- myAssemblyBuilder->SetEntryPoint( myMethodBuilder );
- myAssemblyBuilder->Save( fileName );
-}
-
-int main()
-{
- // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "MyAssembly";
- myAssemblyName->Version = gcnew Version( "1.0.0.2001" );
- MakeAssembly( myAssemblyName, "MyAssembly.exe" );
-
- // Get all the assemblies currently loaded in the application domain.
- array^myAssemblies = Thread::GetDomain()->GetAssemblies();
-
- // Get the dynamic assembly named 'MyAssembly'.
- Assembly^ myAssembly = nullptr;
- for ( int i = 0; i < myAssemblies->Length; i++ )
- {
- if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 )
- myAssembly = myAssemblies[ i ];
- }
- if ( myAssembly != nullptr )
- {
- Console::WriteLine( "\nDisplaying the assembly name\n" );
- Console::WriteLine( myAssembly );
- }
-}
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp
deleted file mode 100644
index 7bd4f7d79f0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Simplified snippet per SuzCook tech review.
-//
-using namespace System;
-using namespace System::Reflection;
-
-int main()
-{
- // Create an AssemblyName, specifying the display name, and then
- // print the properties.
- AssemblyName^ myAssemblyName =
- gcnew AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null");
- Console::WriteLine("Name: {0}", myAssemblyName->Name);
- Console::WriteLine("Version: {0}", myAssemblyName->Version);
- Console::WriteLine("CultureInfo: {0}", myAssemblyName->CultureInfo);
- Console::WriteLine("FullName: {0}", myAssemblyName->FullName);
-}
-/* This code example produces output similar to the following:
-
-Name: Example
-Version: 1.0.0.2001
-CultureInfo: en-US
-FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp
deleted file mode 100644
index 2f372084604..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-// System::Reflection::AssemblyName::GetAssemblyName(String*)
-// System::Reflection::AssemblyName
-/*
- This example demonstrates the 'GetAssemblyName(String*)' and 'ToString()'
- methods of the 'AssemblyName' class. Get the path of 'System.dll' from
- the path of 'mscorlib.dll'. Get the assembly information from 'System.dll'
- and display the information to the console.
- */
-//
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
-
- // Replace the string "MyAssembly.exe" with the name of an assembly,
- // including a path if necessary. If you do not have another assembly
- // to use, you can use whatever name you give to this assembly.
- //
- AssemblyName^ myAssemblyName = AssemblyName::GetAssemblyName( "MyAssembly.exe" );
- Console::WriteLine( "\nDisplaying assembly information:\n" );
- Console::WriteLine( myAssemblyName );
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp
deleted file mode 100644
index ce82c90bc54..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-
-// System::Reflection::AssemblyName::KeyPair
-// System::Reflection::AssemblyName::GetPublicKey()
-// System::Reflection::AssemblyName::GetPublicKeyToken()
-// System::Reflection::AssemblyName::Flags
-// System::Reflection::AssemblyName::VersionCompatibility
-/*
- The following example demonstrates the 'GetPublicKey()' and
- 'GetPublicKeyToken()' methods and the 'KeyPair', 'Flags' and 'VersionCompatibility'
- properties of the 'AssemblyName' class. Creates a dynamic assembly named 'MyAssembly'
- with a module named 'MyModule' and a type within the module named 'MyType'.
- The type 'MyType' has a single method called 'Main' which is also the entry
- point to the assembly. The creation of the dynamic assembly is carried out
- by the method called 'MakeAssembly'. After the assembly is created with the
- help of 'MakeAssembly' the assemblies currently loaded are found and the
- dynamic assembly that we have created is searched for, which is displayed
- to the console. Moreover the public key and the public key token are displayed
- The dynamic assembly is also saved to a file named 'MyAssembly.exe'. The
- dynamic assembly that has been created has a strong name containing a private
- and a public key which is generated by a tool named 'Sn.exe'. The key pair
- is stored in a file named 'KeyPair.snk'.
-
- Note : Run 'MyAssembly.exe' which this example has created for a simple
- 'Hello World!' display.
-*/
-//
-//
-//
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Threading;
-using namespace System::IO;
-using namespace System::Globalization;
-using namespace System::Reflection::Emit;
-using namespace System::Configuration::Assemblies;
-using namespace System::Text;
-static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName )
-{
- // Get the assembly builder from the application domain associated with the current thread.
- AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in the assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" );
-
- // Create a method called 'Main'.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr );
-
- // Get the Intermediate Language generator for the method.
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
-
- // Use the utility method to generate the IL instructions that print a String* to the console.
- myILGenerator->EmitWriteLine( "Hello World!" );
-
- // Generate the 'ret' IL instruction.
- myILGenerator->Emit( OpCodes::Ret );
-
- // End the creation of the type.
- myTypeBuilder->CreateType();
-
- // Set the method with name 'Main' as the entry point in the assembly.
- myAssemblyBuilder->SetEntryPoint( myMethodBuilder );
- myAssemblyBuilder->Save( fileName );
-}
-
-int main()
-{
- // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
-
- // Set the codebase to the physical directory were the assembly resides.
- myAssemblyName->CodeBase = Directory::GetCurrentDirectory();
-
- // Set the culture information of the assembly to 'English-American'.
- myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" );
-
- // Set the hash algorithm to 'SHA256'.
- myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256;
- myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess;
- myAssemblyName->Flags = AssemblyNameFlags::PublicKey;
-
- // Provide this assembly with a strong name.
- myAssemblyName->KeyPair = gcnew StrongNameKeyPair( File::Open( "KeyPair.snk", FileMode::Open, FileAccess::Read ) );
- myAssemblyName->Name = "MyAssembly";
- myAssemblyName->Version = gcnew Version( "1.0.0.2001" );
- MakeAssembly( myAssemblyName, "MyAssembly.exe" );
-
- // Get the assemblies loaded in the current application domain.
- array^myAssemblies = Thread::GetDomain()->GetAssemblies();
-
- // Get the dynamic assembly named 'MyAssembly'.
- Assembly^ myAssembly = nullptr;
- for ( int i = 0; i < myAssemblies->Length; i++ )
- if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 )
- myAssembly = myAssemblies[ i ];
-
- // Display the full assembly information to the console.
- if ( myAssembly != nullptr )
- {
- Console::WriteLine( "\nDisplaying the full assembly name.\n" );
- Console::WriteLine( myAssembly->GetName()->FullName );
- Console::WriteLine( "\nDisplaying the public key.\n" );
- array^pk;
- pk = myAssembly->GetName()->GetPublicKey();
- for ( int i = 0; i < pk->GetLength( 0 ); i++ )
- Console::Write( " {0:x2}", pk[ i ] );
- Console::WriteLine();
- Console::WriteLine( "\nDisplaying the public key token.\n" );
- array^pt;
- pt = myAssembly->GetName()->GetPublicKeyToken();
- for ( int i = 0; i < pt->GetLength( 0 ); i++ )
- Console::Write( " {0:x2}", pt[ i ] );
- }
-}
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp
deleted file mode 100644
index 105e762cd75..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-
-// System::Reflection::AssemblyName::SetPublicKey(Byte->Item[])
-// System::Reflection::AssemblyName::SetPublicKeyToken(Byte->Item[])
-/*
- The following example demonstrates the 'SetPublicKey(Byte->Item[])' and the
- 'SetPublicKeyToken(Byte->Item[])' methods of the 'AssemblyName' class. Creates
- a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and
- a type within the module named 'MyType'. The type 'MyType' has a single
- method called 'Main' which is also the entry point to the assembly. The
- creation of the dynamic assembly is carried out by the method called
- 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly'
- the assemblies currently loaded are found and the dynamic assembly that we
- have created is searched for, which is displayed to the console. The dynamic
- assembly is also saved to a file named 'MyAssembly.exe'. The assembly is
- provided with a strong name. This is done by getting the public key and
- the public key token from the 'KeyPair.snk' (private and public key file).
- The public key is stored in 'PublicKey.snk' and the public key token is
- stored in 'PublicKeyToken.snk' with the help of the tool named 'sn.exe'.
-
- Note : Running 'MyAssembly.exe' with this example does not display 'Hello World!'
- since this assembly has been stongly signed.
-*/
-
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Threading;
-using namespace System::IO;
-using namespace System::Globalization;
-using namespace System::Reflection::Emit;
-using namespace System::Configuration::Assemblies;
-using namespace System::Text;
-
-static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName )
-{
- // Get the assembly builder from the application domain associated with the current thread.
- AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in the assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" );
-
- // Create a method called 'Main'.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr );
-
- // Get the Intermediate Language generator for the method.
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
-
- // Use the utility method to generate the IL instructions that print a String* to the console.
- myILGenerator->EmitWriteLine( "Hello World!" );
-
- // Generate the 'ret' IL instruction.
- myILGenerator->Emit( OpCodes::Ret );
-
- // End the creation of the type.
- myTypeBuilder->CreateType();
-
- // Set the method with name 'Main' as the entry point in the assembly.
- myAssemblyBuilder->SetEntryPoint( myMethodBuilder );
- myAssemblyBuilder->Save( fileName );
-}
-
-int main()
-{
- // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
-
- // Set the codebase to the physical directory were the assembly resides.
- myAssemblyName->CodeBase = Directory::GetCurrentDirectory();
-
- // Set the culture information of the assembly to 'English-American'.
- myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" );
-
- // Set the hash algorithm to 'SHA256'.
- myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256;
- myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess;
- myAssemblyName->Flags = AssemblyNameFlags::PublicKey;
-
- // Get the whole contents of the 'PublicKey.snk' into a Byte array.
- FileStream^ publicKeyStream = File::Open( "PublicKey.snk", FileMode::Open );
- array^publicKey = gcnew array(publicKeyStream->Length);
- publicKeyStream->Read( publicKey, 0, (int)publicKeyStream->Length );
-
- // Provide the assembly with a public key.
- myAssemblyName->SetPublicKey( publicKey );
-
- // Get the whole contents of the 'PublicKeyToken.snk' into a Byte array.
- FileStream^ publicKeyTokenStream = File::Open( "PublicKeyToken.snk", FileMode::Open );
- array^publicKeyToken = gcnew array(publicKeyTokenStream->Length);
- publicKeyTokenStream->Read( publicKeyToken, 0, (int)publicKeyToken->Length );
-
- // Provide the assembly with a public key token.
- myAssemblyName->SetPublicKeyToken( publicKeyToken );
- myAssemblyName->Name = "MyAssembly";
- myAssemblyName->Version = gcnew Version( "1.0.0.2001" );
- MakeAssembly( myAssemblyName, "MyAssembly.exe" );
-
- // Get the assemblies loaded in the current application domain.
- array^myAssemblies = Thread::GetDomain()->GetAssemblies();
-
- // Get the dynamic assembly named 'MyAssembly'.
- Assembly^ myAssembly = nullptr;
- for ( int i = 0; i < myAssemblies->Length; i++ )
- if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 )
- myAssembly = myAssemblies[ i ];
-
- // Display the full assembly information to the console.
- if ( myAssembly != nullptr )
- {
- Console::WriteLine( "\nDisplaying the full assembly name\n" );
- String^ assemblyName = myAssembly->GetName()->FullName;
- Console::WriteLine( assemblyName );
- Console::WriteLine( "\nDisplaying the public key for the assembly\n" );
- array^publicKeyBytes = myAssembly->GetName()->GetPublicKey();
- Console::WriteLine( Encoding::ASCII->GetString( publicKeyBytes ) );
- Console::WriteLine( "\nDisplaying the public key token for the assembly\n" );
- array^publicKeyTokenBytes = myAssembly->GetName()->GetPublicKeyToken();
- Console::WriteLine( Encoding::ASCII->GetString( publicKeyTokenBytes ) );
- }
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp b/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp
deleted file mode 100644
index 382e0b264dd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Globalization;
-using namespace System::Runtime::InteropServices;
-public ref class MyBinder: public Binder
-{
-public:
- MyBinder()
- : Binder()
- {}
-
-private:
- ref class BinderState
- {
- public:
- array^args;
- };
-
-public:
- virtual FieldInfo^ BindToField( BindingFlags bindingAttr, array^match, Object^ value, CultureInfo^ culture ) override
- {
- if ( match == nullptr )
- throw gcnew ArgumentNullException( "match" );
-
- // Get a field for which the value parameter can be converted to the specified field type.
- for ( int i = 0; i < match->Length; i++ )
- if ( ChangeType( value, match[ i ]->FieldType, culture ) != nullptr )
- return match[ i ];
-
- return nullptr;
- }
-
- virtual MethodBase^ BindToMethod( BindingFlags bindingAttr, array^match, array^%args, array^ modifiers, CultureInfo^ culture, array^names, [Out]Object^% state ) override
- {
- // Store the arguments to the method in a state Object*.
- BinderState^ myBinderState = gcnew BinderState;
- array^arguments = gcnew array(args->Length);
- args->CopyTo( arguments, 0 );
- myBinderState->args = arguments;
- state = myBinderState;
- if ( match == nullptr )
- throw gcnew ArgumentNullException;
-
- // Find a method that has the same parameters as those of the args parameter.
- for ( int i = 0; i < match->Length; i++ )
- {
- // Count the number of parameters that match.
- int count = 0;
- array^parameters = match[ i ]->GetParameters();
-
- // Go on to the next method if the number of parameters do not match.
- if ( args->Length != parameters->Length )
- continue;
-
- // Match each of the parameters that the user expects the method to have.
- for ( int j = 0; j < args->Length; j++ )
- {
- // If the names parameter is not 0, then reorder args.
- if ( names != nullptr )
- {
- if ( names->Length != args->Length )
- throw gcnew ArgumentException( "names and args must have the same number of elements." );
-
- for ( int k = 0; k < names->Length; k++ )
- if ( String::Compare( parameters[ j ]->Name, names[ k ] ) == 0 )
- args[ j ] = myBinderState->args[ k ];
- }
-
- // Determine whether the types specified by the user can be converted to the parameter type.
- if ( ChangeType( args[ j ], parameters[ j ]->ParameterType, culture ) != nullptr )
- count += 1;
- else
- break;
- }
- if ( count == args->Length )
- return match[ i ];
- }
- return nullptr;
- }
-
- virtual Object^ ChangeType( Object^ value, Type^ myChangeType, CultureInfo^ culture ) override
- {
- // Determine whether the value parameter can be converted to a value of type myType.
- if ( CanConvertFrom( value->GetType(), myChangeType ) )
- // Return the converted Object*.
- return Convert::ChangeType( value, myChangeType );
- else
- return nullptr;
- }
-
- virtual void ReorderArgumentArray( array^%args, Object^ state ) override
- {
- // Return the args that had been reordered by BindToMethod.
- (safe_cast(state))->args->CopyTo( args, 0 );
- }
-
- virtual MethodBase^ SelectMethod( BindingFlags bindingAttr, array^match, array^types, array^ modifiers ) override
- {
- if ( match == nullptr )
- throw gcnew ArgumentNullException( "match" );
-
- for ( int i = 0; i < match->Length; i++ )
- {
- // Count the number of parameters that match.
- int count = 0;
- array^parameters = match[ i ]->GetParameters();
-
- // Go on to the next method if the number of parameters do not match.
- if ( types->Length != parameters->Length )
- continue;
-
- // Match each of the parameters that the user expects the method to have.
- for ( int j = 0; j < types->Length; j++ )
- {
- // Determine whether the types specified by the user can be converted to parameter type.
- if ( CanConvertFrom( types[ j ], parameters[ j ]->ParameterType ) )
- count += 1;
- else
- break;
- }
- // Determine whether the method has been found.
- if ( count == types->Length )
- return match[ i ];
- }
- return nullptr;
- }
-
- virtual PropertyInfo^ SelectProperty( BindingFlags bindingAttr, array^match, Type^ returnType, array^indexes, array^ modifiers ) override
- {
- if ( match == nullptr )
- throw gcnew ArgumentNullException( "match" );
-
- for ( int i = 0; i < match->Length; i++ )
- {
- // Count the number of indexes that match.
- int count = 0;
- array^parameters = match[ i ]->GetIndexParameters();
-
- // Go on to the next property if the number of indexes do not match.
- if ( indexes->Length != parameters->Length )
- continue;
-
- // Match each of the indexes that the user expects the property to have.
- for ( int j = 0; j < indexes->Length; j++ )
- // Determine whether the types specified by the user can be converted to index type.
- if ( CanConvertFrom( indexes[ j ], parameters[ j ]->ParameterType ) )
- count += 1;
- else
- break;
-
- // Determine whether the property has been found.
- if ( count == indexes->Length )
- {
- // Determine whether the return type can be converted to the properties type.
- if ( CanConvertFrom( returnType, match[ i ]->PropertyType ) )
- return match[ i ];
- else
- continue;
- }
- }
- return nullptr;
- }
-
-private:
-
- // Determines whether type1 can be converted to type2. Check only for primitive types.
- bool CanConvertFrom( Type^ type1, Type^ type2 )
- {
- if ( type1->IsPrimitive && type2->IsPrimitive )
- {
- TypeCode typeCode1 = Type::GetTypeCode( type1 );
- TypeCode typeCode2 = Type::GetTypeCode( type2 );
-
- // If both type1 and type2 have the same type, return true.
- if ( typeCode1 == typeCode2 )
- return true;
-
- // Possible conversions from Char follow.
- if ( typeCode1 == TypeCode::Char )
- {
- switch ( typeCode2 )
- {
- case TypeCode::UInt16:
- return true;
-
- case TypeCode::UInt32:
- return true;
-
- case TypeCode::Int32:
- return true;
-
- case TypeCode::UInt64:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from Byte follow.
- if ( typeCode1 == TypeCode::Byte )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Char:
- return true;
-
- case TypeCode::UInt16:
- return true;
-
- case TypeCode::Int16:
- return true;
-
- case TypeCode::UInt32:
- return true;
-
- case TypeCode::Int32:
- return true;
-
- case TypeCode::UInt64:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from SByte follow.
- if ( typeCode1 == TypeCode::SByte )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Int16:
- return true;
-
- case TypeCode::Int32:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from UInt16 follow.
- if ( typeCode1 == TypeCode::UInt16 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::UInt32:
- return true;
-
- case TypeCode::Int32:
- return true;
-
- case TypeCode::UInt64:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from Int16 follow.
- if ( typeCode1 == TypeCode::Int16 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Int32:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from UInt32 follow.
- if ( typeCode1 == TypeCode::UInt32 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::UInt64:
- return true;
-
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from Int32 follow.
- if ( typeCode1 == TypeCode::Int32 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Int64:
- return true;
-
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from UInt64 follow.
- if ( typeCode1 == TypeCode::UInt64 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from Int64 follow.
- if ( typeCode1 == TypeCode::Int64 )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Single:
- return true;
-
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
-
- // Possible conversions from Single follow.
- if ( typeCode1 == TypeCode::Single )
- {
- switch ( typeCode2 )
- {
- case TypeCode::Double:
- return true;
-
- default:
- return false;
- }
- }
- }
-
- return false;
- }
-
-};
-
-public ref class MyClass1
-{
-public:
- short myFieldB;
- int myFieldA;
- void MyMethod( long i, char k )
- {
- Console::WriteLine( "\nThis is MyMethod(long i, char k)" );
- }
-
- void MyMethod( long i, long j )
- {
- Console::WriteLine( "\nThis is MyMethod(long i, long j)" );
- }
-};
-
-int main()
-{
- // Get the type of MyClass1.
- Type^ myType = MyClass1::typeid;
-
- // Get the instance of MyClass1.
- MyClass1^ myInstance = gcnew MyClass1;
- Console::WriteLine( "\nDisplaying the results of using the MyBinder binder.\n" );
-
- // Get the method information for MyMethod.
- array^types = {short::typeid,short::typeid};
- MethodInfo^ myMethod = myType->GetMethod( "MyMethod", static_cast(BindingFlags::Public | BindingFlags::Instance), gcnew MyBinder, types, nullptr );
- Console::WriteLine( myMethod );
-
- // Invoke MyMethod.
- array^obj = {32,32};
- myMethod->Invoke( myInstance, BindingFlags::InvokeMethod, gcnew MyBinder, obj, CultureInfo::CurrentCulture );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp b/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp
deleted file mode 100644
index 9657b10660c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Reflection;
-using namespace System::IO;
-
-//namespace BindingFlagsSnippet {
-public ref class TestClass
-{
-public:
- String^ Name;
-
-private:
- array^ values;
- int methodCalled;
-
-public:
-
- property Object^ Item [int]
- {
- Object^ get( int index )
- {
- return values[ index ];
- }
-
- void set( int index, Object^ value )
- {
- values[ index ] = value;
- }
- }
-
- property Object^ Value
- {
- Object^ get()
- {
- return "the value";
- }
- }
-
- TestClass()
- {
- Name = "initialName";
- values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9};
- methodCalled = 0;
- }
-
- TestClass(String^ initName)
- {
- Name = initName;
- values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9};
- methodCalled = 0;
- }
-
- static void SayHello()
- {
- Console::WriteLine( "Hello" );
- }
-
- void AddUp()
- {
- methodCalled++;
- Console::WriteLine( "AddUp Called {0} times", methodCalled );
- }
-
- static double ComputeSum( double d1, double d2 )
- {
- return d1 + d2;
- }
-
- static void PrintName( String^ firstName, String^ lastName )
- {
- Console::WriteLine( "{0},{1}", lastName, firstName );
- }
-
- void PrintTime()
- {
- Console::WriteLine( DateTime::Now );
- }
-
- void Swap( interior_ptr a, interior_ptr b )
- {
- int x = *a;
- *a = *b;
- *b = x;
- }
-};
-
-
-[DefaultMemberAttribute("PrintTime")]
-public ref class TestClass2
-{
-public:
- void PrintTime()
- {
- Console::WriteLine( DateTime::Now );
- }
-
-};
-
-public ref class Base
-{
-private:
- static int BaseOnlyPrivate = 0;
-protected:
- static int BaseOnly = 0;
-};
-
-public ref class Derived : Base
-{
-public:
- static int DerivedOnly = 0;
-};
-
-public ref class MostDerived : Derived {};
-
-void main()
-{
- array^ noArguments;
-
- // BindingFlags::InvokeMethod
- // Call a static method.
- Type^ t = TestClass::typeid;
- Console::WriteLine();
- Console::WriteLine( "Invoking a static method." );
- Console::WriteLine( "-------------------------" );
- t->InvokeMember( "SayHello", BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static,
- nullptr, nullptr, noArguments );
-
- // BindingFlags::InvokeMethod
- // Call an instance method.
- TestClass^ c = gcnew TestClass;
- Console::WriteLine();
- Console::WriteLine( "Invoking an instance method." );
- Console::WriteLine( "----------------------------" );
- c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments );
- c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments );
-
- // BindingFlags::InvokeMethod
- // Call a method with parameters.
- array^args = {100.09,184.45};
- Object^ result;
- Console::WriteLine();
- Console::WriteLine( "Invoking a method with parameters." );
- Console::WriteLine( "---------------------------------" );
- result = t->InvokeMember( "ComputeSum", BindingFlags::InvokeMethod, nullptr, nullptr, args );
- Console::WriteLine( " {0} + {1} = {2}", args[ 0 ], args[ 1 ], result );
-
- // BindingFlags::GetField, SetField
- Console::WriteLine();
- Console::WriteLine( "Invoking a field (getting and setting.)" );
- Console::WriteLine( "--------------------------------------" );
-
- // Get a field value.
- result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments );
- Console::WriteLine( "Name == {0}", result );
-
- // Set a field.
- array^obj2 = {"NewName"};
- t->InvokeMember( "Name", BindingFlags::SetField, nullptr, c, obj2 );
- result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments );
- Console::WriteLine( "Name == {0}", result );
- Console::WriteLine();
- Console::WriteLine( "Invoking an indexed property (getting and setting.)" );
- Console::WriteLine( "--------------------------------------------------" );
-
- // BindingFlags::GetProperty
- // Get an indexed property value.
- int index = 3;
- array^obj3 = {index};
- result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 );
- Console::WriteLine( "Item->Item[ {0}] == {1}", index, result );
-
- // BindingFlags::SetProperty
- // Set an indexed property value.
- index = 3;
- array^obj4 = {index,"NewValue"};
- t->InvokeMember( "Item", BindingFlags::SetProperty, nullptr, c, obj4 );
- result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 );
- Console::WriteLine( "Item->Item[ {0}] == {1}", index, result );
- Console::WriteLine();
- Console::WriteLine( "Getting a field or property." );
- Console::WriteLine( "----------------------------" );
-
- // BindingFlags::GetField
- // Get a field or property.
- result = t->InvokeMember( "Name", static_cast(BindingFlags::GetField |
- BindingFlags::GetProperty), nullptr, c, noArguments );
- Console::WriteLine( "Name == {0}", result );
-
- // BindingFlags::GetProperty
- result = t->InvokeMember( "Value", static_cast(BindingFlags::GetField |
- BindingFlags::GetProperty), nullptr, c, noArguments );
- Console::WriteLine( "Value == {0}", result );
- Console::WriteLine();
- Console::WriteLine( "Invoking a method with named parameters." );
- Console::WriteLine( "---------------------------------------" );
-
- // BindingFlags::InvokeMethod
- // Call a method using named parameters.
- array^argValues = {"Mouse","Micky"};
- array^argNames = {"lastName","firstName"};
- t->InvokeMember( "PrintName", BindingFlags::InvokeMethod, nullptr, nullptr, argValues, nullptr,
- nullptr, argNames );
- Console::WriteLine();
- Console::WriteLine( "Invoking a default member of a type." );
- Console::WriteLine( "------------------------------------" );
-
- // BindingFlags::Default
- // Call the default member of a type.
- Type^ t3 = TestClass2::typeid;
- t3->InvokeMember( "", static_cast(BindingFlags::InvokeMethod | BindingFlags::Default),
- nullptr, gcnew TestClass2, noArguments );
-
- // BindingFlags::Static, NonPublic, and Public
- // Invoking a member with ref parameters.
- Console::WriteLine();
- Console::WriteLine( "Invoking a method with ref parameters." );
- Console::WriteLine( "--------------------------------------" );
- MethodInfo^ m = t->GetMethod( "Swap" );
- args = gcnew array(2);
- args[ 0 ] = 1;
- args[ 1 ] = 2;
- m->Invoke( gcnew TestClass, args );
- Console::WriteLine( "{0}, {1}", args[ 0 ], args[ 1 ] );
-
- // BindingFlags::CreateInstance
- // Creating an instance with a parameterless constructor.
- Console::WriteLine();
- Console::WriteLine( "Creating an instance with a parameterless constructor." );
- Console::WriteLine( "------------------------------------------------------" );
- Object^ obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public |
- BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, noArguments );
- Console::WriteLine("Instance of {0} created.", obj->GetType()->Name);
-
- // Creating an instance with a constructor that has parameters.
- Console::WriteLine();
- Console::WriteLine( "Creating an instance with a constructor that has parameters." );
- Console::WriteLine( "------------------------------------------------------------" );
- obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public |
- BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr,
- gcnew array { "Hello, World!" } );
- Console::WriteLine("Instance of {0} created with initial value '{1}'.", obj->GetType()->Name,
- obj->GetType()->InvokeMember("Name", BindingFlags::GetField, nullptr, obj, noArguments));
-
- // BindingFlags::DeclaredOnly
- Console::WriteLine();
- Console::WriteLine( "DeclaredOnly instance members." );
- Console::WriteLine( "------------------------------" );
- array^memInfo = t->GetMembers( BindingFlags::DeclaredOnly |
- BindingFlags::Instance | BindingFlags::Public);
- for ( int i = 0; i < memInfo->Length; i++ )
- {
- Console::WriteLine( memInfo[ i ]->Name );
-
- }
-
- // BindingFlags::IgnoreCase
- Console::WriteLine();
- Console::WriteLine( "Using IgnoreCase and invoking the PrintName method." );
- Console::WriteLine( "---------------------------------------------------" );
- t->InvokeMember( "printname", static_cast(BindingFlags::IgnoreCase |
- BindingFlags::Static | BindingFlags::Public | BindingFlags::InvokeMethod),
- nullptr, nullptr, gcnew array {"Brad","Smith"});
-
- // BindingFlags::FlattenHierarchy
- Console::WriteLine();
- Console::WriteLine( "Using FlattenHierarchy to get inherited static protected and public members." );
- Console::WriteLine( "----------------------------------------------------------------------------" );
- array^ finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic |
- BindingFlags::Public | BindingFlags::Static | BindingFlags::FlattenHierarchy);
- for each (FieldInfo^ finfo in finfos)
- {
- Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name);
- }
-
- Console::WriteLine();
- Console::WriteLine("Without FlattenHierarchy." );
- Console::WriteLine("-------------------------");
- finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic | BindingFlags::Public |
- BindingFlags::Static);
- for each (FieldInfo^ finfo in finfos)
- {
- Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name);
- }
-};
-
-/* This example produces output similar to the following:
-
-Invoking a static method.
--------------------------
-Hello
-
-Invoking an instance method.
-----------------------------
-AddUp Called 1 times
-AddUp Called 2 times
-
-Invoking a method with parameters.
----------------------------------
- 100.09 + 184.45 = 284.54
-
-Invoking a field (getting and setting.)
---------------------------------------
-Name == initialName
-Name == NewName
-
-Invoking an indexed property (getting and setting.)
---------------------------------------------------
-Item->Item[ 3] == 3
-Item->Item[ 3] == NewValue
-
-Getting a field or property.
-----------------------------
-Name == NewName
-Value == the value
-
-Invoking a method with named parameters.
----------------------------------------
-Mouse,Micky
-
-Invoking a default member of a type.
-------------------------------------
-12/23/2009 4:19:06 PM
-
-Invoking a method with ref parameters.
---------------------------------------
-2, 1
-
-Creating an instance with a parameterless constructor.
-------------------------------------------------------
-Instance of TestClass created.
-
-Creating an instance with a constructor that has parameters.
-------------------------------------------------------------
-Instance of TestClass created with initial value 'Hello, World!'.
-
-DeclaredOnly instance members.
-------------------------------
-get_Item
-set_Item
-get_Value
-AddUp
-PrintTime
-Swap
-.ctor
-.ctor
-Value
-Item
-Name
-methodCalled
-
-Using IgnoreCase and invoking the PrintName method.
----------------------------------------------------
-Smith,Brad
-
-Using FlattenHierarchy to get inherited static protected and public members.
-----------------------------------------------------------------------------
-DerivedOnly defined in Derived.
-BaseOnly defined in Base.
-
-Without FlattenHierarchy.
--------------------------
-
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp
deleted file mode 100644
index da26b213429..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// System.Reflection.Emit.ConstructorBuilder.AddDeclarativeSecurity()
-// System.Reflection.Emit.ConstructorBuilder.Attributes
-// System.Reflection.Emit.ConstructorBuilder.DeclaringType
-// System.Reflection.Emit.ConstructorBuilder.DefineParameter()
-
-/* The following program demonstrates the 'AddDeclarativeSecurity',
-'DefineParameter' methods, and 'Attributes', 'DeclaringType' properties
-of the ConstructorBuilder class. Create the assembly in the current domain
-with dynamic module in the assembly. Constructor builder is used in
-conjunction with the 'TypeBuilder' class to create constructor at run time.
-Add declarative security to the constructor. Display the 'Attributes',
-'DeclaringType' and 'DefineParameter'.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Security::Permissions;
-using namespace System::Security;
-
-public ref class MyConstructorBuilder
-{
-private:
- Type^ myType1;
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- MyConstructorBuilder()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
-
-//
-//
-//
- MethodBuilder^ myMethodBuilder = nullptr;
-
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
- // Create assembly in current CurrentDomain
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
- // Create a dynamic assembly
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::RunAndSave );
- // Create a dynamic module in the assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
- FieldInfo^ myFieldInfo =
- myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public );
- // Create a type in the module
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
- FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting",
- String::typeid, FieldAttributes::Public );
- array^myConstructorArgs = {String::typeid};
- // Define a constructor of the dynamic class.
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor(
- MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
- PermissionSet^ myPset = gcnew PermissionSet( PermissionState::Unrestricted );
- // Add declarative security to the constructor.
- Console::WriteLine( "Adding declarative security to the constructor....." );
- Console::WriteLine( "The Security action to be taken is \"DENY\" and" +
- " Permission set is \"UNRESTRICTED\"." );
- myConstructor->AddDeclarativeSecurity( SecurityAction::Deny, myPset );
-//
- MethodAttributes myMethodAttributes = myConstructor->Attributes;
- Type^ myAttributeType = MethodAttributes::typeid;
- int myAttribValue = (int)myMethodAttributes;
- if ( !myAttributeType->IsEnum )
- {
- Console::WriteLine( "This is not an Enum" );
- }
- array^myFieldInfo1 = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) );
- Console::WriteLine( "The Field info names of the Attributes for the constructor are:" );
- for ( int i = 0; i < myFieldInfo1->Length; i++ )
- {
- int myFieldValue = *dynamic_cast(myFieldInfo1[ i ]->GetValue( nullptr ));
- if ( (myFieldValue & myAttribValue) == myFieldValue )
- {
- Console::WriteLine( " {0}", myFieldInfo1[ i ]->Name );
- }
- }
-
- Type^ myType2 = myConstructor->DeclaringType;
- Console::WriteLine( "The declaring type is : {0}", myType2 );
-//
- ParameterBuilder^ myParameterBuilder1 =
- myConstructor->DefineParameter( 1, ParameterAttributes::Out, "My Parameter Name1" );
- Console::WriteLine( "The name of the parameter is : {0}",
- myParameterBuilder1->Name );
- if ( myParameterBuilder1->IsIn )
- Console::WriteLine( "{0} is Input parameter.", myParameterBuilder1->Name );
- else
- Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder1->Name );
- ParameterBuilder^ myParameterBuilder2 =
- myConstructor->DefineParameter( 1, ParameterAttributes::In, "My Parameter Name2" );
- Console::WriteLine( "The Parameter name is : {0}",
- myParameterBuilder2->Name );
- if ( myParameterBuilder2->IsIn )
- Console::WriteLine( "{0} is Input parameter.", myParameterBuilder2->Name );
- else
- Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder2->Name );
-//
- // Generate MSIL for the method, call its base class constructor and store the arguments
- // in the private field.
- ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator();
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) );
- myILGenerator3->Emit( OpCodes::Call, myConstructorInfo );
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- myILGenerator3->Emit( OpCodes::Ldarg_1 );
- myILGenerator3->Emit( OpCodes::Stfld, myGreetingField );
- myILGenerator3->Emit( OpCodes::Ret );
- // Add a method to the type.
- myMethodBuilder = myTypeBuilder->DefineMethod(
- "HelloWorld", MethodAttributes::Public, nullptr, nullptr );
- // Generate MSIL for the method.
- ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator();
- myILGenerator2->EmitWriteLine( "Hello World from global" );
- myILGenerator2->Emit( OpCodes::Ret );
- myModuleBuilder->CreateGlobalFunctions();
- myType1 = myTypeBuilder->CreateType();
- }
- property Type^ MyTypeProperty
- {
- Type^ get()
- {
- return this->myType1;
- }
- }
-};
-int main()
-{
- MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder;
- Type^ myType1 = myConstructorBuilder->MyTypeProperty;
- if ( nullptr != myType1 )
- {
- Console::WriteLine( "Instantiating the new type..." );
- array^myObject = {"hello"};
- Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr );
- MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" );
- if ( nullptr != myMethodInfo )
- {
- Console::WriteLine( "Invoking dynamically created HelloWorld method..." );
- myMethodInfo->Invoke( myObject1, nullptr );
- }
- else
- {
- Console::WriteLine( "Could not locate HelloWorld method" );
- }
- }
- else
- {
- Console::WriteLine( "Could not access Type." );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp
deleted file mode 100644
index 6bc0d5da26e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// System.Reflection.Emit.ConstructorBuilder.GetModule()
-// System.Reflection.Emit.ConstructorBuilder.GetToken()
-// System.Reflection.Emit.ConstructorBuilder.GetMethodImplementationFlags()
-// System.Reflection.Emit.ConstructorBuilder.GetParameters()
-
-/* The following program demonstrates the 'GetModule','GetToken',
-'GetMethodImplementationFlags' and 'GetParameters'
-methods of 'ConstructorBuilder' class. Create the assembly
-in the current domain with dynamic module in the assembly. Constructor
-builder is used in conjunction with the 'TypeBuilder' class to create
-constructor at run time. Set a custom attribute using a custom attribute
-builder and displays module name, Token id and parameter info of this class.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-
-public ref class MyConstructorBuilder
-{
-private:
- Type^ myType1;
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- MyConstructorBuilder()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
-//
-//
-
- MethodBuilder^ myMethodBuilder = nullptr;
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
- // Create assembly in current CurrentDomain.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
- // Create a dynamic assembly.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
- // Create a dynamic module in the assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
- FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting",
- String::typeid, FieldAttributes::Public );
- array^myConstructorArgs = {String::typeid};
-//
-//
- // Define a constructor of the dynamic class.
- ConstructorBuilder^ myConstructorBuilder = myTypeBuilder->DefineConstructor(
- MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
- // Get a reference to the module that contains this constructor.
- Module^ myModule = myConstructorBuilder->GetModule();
- Console::WriteLine( "Module Name : {0}", myModule->Name );
- // Get the 'MethodToken' that represents the token for this constructor.
- MethodToken myMethodToken = myConstructorBuilder->GetToken();
- Console::WriteLine( "Constructor Token is : {0}", myMethodToken.Token );
- // Get the method implementation flags for this constructor.
- MethodImplAttributes myMethodImplAttributes = myConstructorBuilder->GetMethodImplementationFlags();
- Console::WriteLine( "MethodImplAttributes : {0}", myMethodImplAttributes );
-//
-//
-//
- // Generate IL for the method, call its base class constructor and store the arguments
- // in the private field.
- ILGenerator^ myILGenerator3 = myConstructorBuilder->GetILGenerator();
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) );
- myILGenerator3->Emit( OpCodes::Call, myConstructorInfo );
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- myILGenerator3->Emit( OpCodes::Ldarg_1 );
- myILGenerator3->Emit( OpCodes::Stfld, myGreetingField );
- myILGenerator3->Emit( OpCodes::Ret );
- // Add a method to the type.
- myMethodBuilder = myTypeBuilder->DefineMethod(
- "HelloWorld", MethodAttributes::Public, nullptr, nullptr );
- // Generate IL for the method.
- ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator();
- myILGenerator2->EmitWriteLine( "Hello World from global" );
- myILGenerator2->Emit( OpCodes::Ret );
- myModuleBuilder->CreateGlobalFunctions();
- myType1 = myTypeBuilder->CreateType();
-
- // Get the parameters of this constructor.
- array^myParameterInfo = myConstructorBuilder->GetParameters();
- for ( int i = 0; i < myParameterInfo->Length; i++ )
- {
- Console::WriteLine( "Declaration type : {0}", myParameterInfo[ i ]->Member->DeclaringType );
- }
-//
- }
- property Type^ MyTypeProperty
- {
- Type^ get()
- {
- return this->myType1;
- }
- }
-};
-
-int main()
-{
- MyConstructorBuilder^ myConstructorBuilder1 = gcnew MyConstructorBuilder;
- Type^ myTypeProperty = myConstructorBuilder1->MyTypeProperty;
- if ( nullptr != myTypeProperty )
- {
- array^myObject = {"Hello"};
- Object^ myObject1 = Activator::CreateInstance( myTypeProperty, myObject, (Object^) 0 );
- MethodInfo^ myMethodInfo = myTypeProperty->GetMethod( "HelloWorld" );
-
- if ( nullptr != myMethodInfo )
- {
- myMethodInfo->Invoke( myObject1, nullptr );
- }
- else
- {
- Console::WriteLine( "Could not locate HelloWorld method" );
- }
- }
- else
- {
- Console::WriteLine( "Could not access Type." );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp
deleted file mode 100644
index 90448fc379b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-
-// System.Reflection.Emit.ConstructorBuilder
-// System.Reflection.Emit.ConstructorBuilder.Name
-// System.Reflection.Emit.ConstructorBuilder.ReflectedType
-// System.Reflection.Emit.ConstructorBuilder.Signature
-// System.Reflection.Emit.ConstructorBuilder.ToString()
-/* The following program demonstrates the 'ConstructorBuilder' class,
-its 'Name', 'ReflectedType', 'Signature' properties and 'ToString'
-method. Create the assembly in the current domain with dynamic module
-in the assembly. ConstructorBuilder is used in conjunction with the
-'TypeBuilder' class to create constructor at run time. Display the
-'Name', 'Signature' and 'ReflectedType' to the console.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-public ref class MyConstructorBuilder
-{
-private:
- Type^ myType1;
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- MyConstructorBuilder()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
-
- //
- MethodBuilder^ myMethodBuilder = nullptr;
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
-
- // Create assembly in current CurrentDomain.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Create a dynamic assembly.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module in the assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
- FieldInfo^ myFieldInfo = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
- FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public );
- array^myConstructorArgs = {String::typeid};
-
- // Define a constructor of the dynamic class.
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
-
- // Display the name of the constructor.
- Console::WriteLine( "The constructor name is : {0}", myConstructor->Name );
-
- // Display the 'Type' object from which this object was obtained.
- Console::WriteLine( "The reflected type is : {0}", myConstructor->ReflectedType );
-
- // Display the signature of the field.
- Console::WriteLine( myConstructor->Signature );
-
- // Display the constructor builder instance as a string.
- Console::WriteLine( myConstructor );
- //
-
- // Generate IL for the method, call its superclass constructor and store the arguments
- // in the private field.
- ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator();
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) );
- myILGenerator3->Emit( OpCodes::Call, myConstructorInfo );
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- myILGenerator3->Emit( OpCodes::Ldarg_1 );
- myILGenerator3->Emit( OpCodes::Stfld, myGreetingField );
- myILGenerator3->Emit( OpCodes::Ret );
-
- // Add a method to the type.
- myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr );
-
- // Generate IL for the method.
- ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator();
- myILGenerator2->EmitWriteLine( "Hello World from global" );
- myILGenerator2->Emit( OpCodes::Ret );
- myModuleBuilder->CreateGlobalFunctions();
- myType1 = myTypeBuilder->CreateType();
- }
-
- property Type^ MyTypeProperty
- {
- Type^ get()
- {
- return this->myType1;
- }
- }
-};
-
-int main()
-{
- MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder;
- Type^ myType1 = myConstructorBuilder->MyTypeProperty;
- if ( nullptr != myType1 )
- {
- Console::WriteLine( "Instantiating the new type..." );
- array^myObject = {"hello"};
- Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr );
- MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" );
- if ( nullptr != myMethodInfo )
- {
- Console::WriteLine( "Invoking dynamically created HelloWorld method..." );
- myMethodInfo->Invoke( myObject1, nullptr );
- }
- else
- {
- Console::WriteLine( "Could not locate HelloWorld method" );
- }
- }
- else
- {
- Console::WriteLine( "Could not access Type." );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp
deleted file mode 100644
index df97697cd2e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-
-// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(CustomAttributeBuilder)
-/*
- The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)'
- method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived
- from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute
- and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type
- and displays its contents to the console.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- String^ myString;
- int myInteger;
- MyAttribute( String^ myString, int myInteger )
- {
- this->myString = myString;
- this->myInteger = myInteger;
- }
-
-};
-
-static Type^ MyCreateCallee( AppDomain^ domain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Define a dynamic assembly in the current application domain->
- AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Define a dynamic module in this assembly->
- ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Construct a 'TypeBuilder' given the name and attributes.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define a constructor of the dynamic class.
- array^type1 = {String::typeid};
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 );
- ILGenerator^ myILGenerator = myConstructor->GetILGenerator();
- myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" );
- myILGenerator->Emit( OpCodes::Ldarg_1 );
- array^type2 = {String::typeid};
- MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 );
- myILGenerator->Emit( OpCodes::Call, myMethodInfo );
- myILGenerator->Emit( OpCodes::Ret );
- Type^ myType = MyAttribute::typeid;
- array^type3 = {String::typeid,int::typeid};
- ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 );
- array^obj1 = {"Hello",2};
- CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 );
- try
- {
- myConstructor->SetCustomAttribute( attributeBuilder );
- }
- catch ( ArgumentNullException^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
- catch ( Exception^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
-
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() );
- array^type1 = {String::typeid};
- ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 );
- array^myAttributes1 = myConstructor->GetCustomAttributes( true );
- Console::WriteLine( "MyAttribute custom attribute contains " );
- for ( int index = 0; index < myAttributes1->Length; index++ )
- {
- if ( dynamic_cast(myAttributes1[ index ]) )
- {
- Console::WriteLine( "The value of myString is : {0}", (safe_cast(myAttributes1[ index ]))->myString );
- Console::WriteLine( "The value of myInteger is : {0}", (safe_cast(myAttributes1[ index ]))->myInteger );
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp
deleted file mode 100644
index 7c6ae9bf4cb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-
-// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[])
-/*
- The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, Byte[])'
- method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived
- from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute
- and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type
- and displays its contents to the console.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- bool myBoolean;
- MyAttribute( bool myBoolean )
- {
- this->myBoolean = myBoolean;
- }
-};
-
-static Type^ MyCreateCallee( AppDomain^ domain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Define a dynamic assembly in the current application domain.
- AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Define a dynamic module in this assembly.
- ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Construct a 'TypeBuilder' given the name and attributes.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define a constructor of the dynamic class.
- array^type1 = {String::typeid};
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 );
- ILGenerator^ myILGenerator = myConstructor->GetILGenerator();
- myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" );
- myILGenerator->Emit( OpCodes::Ldarg_1 );
- array^type2 = {String::typeid};
- MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 );
- myILGenerator->Emit( OpCodes::Call, myMethodInfo );
- myILGenerator->Emit( OpCodes::Ret );
- Type^ myType = MyAttribute::typeid;
- array^type3 = {bool::typeid};
- ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 );
- try
- {
- array^bytes = {01,00,01};
- myConstructor->SetCustomAttribute( myConstructorInfo, bytes );
- }
- catch ( ArgumentNullException^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
- catch ( Exception^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
-
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() );
- array^type1 = {String::typeid};
- ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 );
- array^myAttributes1 = myConstructor->GetCustomAttributes( true );
- Console::WriteLine( "MyAttribute custom attribute contains " );
- for ( int index = 0; index < myAttributes1->Length; index++ )
- {
- if ( dynamic_cast(myAttributes1[ index ]) )
- {
- Console::WriteLine( "myBoolean : {0}", safe_cast(myAttributes1[ index ])->myBoolean );
- }
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp
deleted file mode 100644
index 9ff254e4a6c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-
-// System::Reflection::Emit::ConstructorBuilder.SetImplementationFlags()
-/* The following program demonstrates the 'SetImplementationFlags'
- method of ConstructorBuilder class. It creates an assembly in the
- current domain with a dynamic module in the assembly. Constructor
- builder is used in conjunction with the 'TypeBuilder' class to create
- constructor at run time. It then sets the method implementation flags
- for the constructor and displays the same.
-*/
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-public ref class MyConstructorBuilder
-{
-private:
- Type^ myType1;
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- MyConstructorBuilder()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
- try
- {
- //
- MethodBuilder^ myMethodBuilder = nullptr;
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
-
- // Create assembly in current CurrentDomain.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Create a dynamic assembly.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module in the assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true );
- FieldInfo^ myFieldInfo2 = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
- FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public );
- array^myConstructorArgs = {String::typeid};
-
- // Define a constructor of the dynamic class.
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
-
- // Set the method implementation flags for the constructor.
- myConstructor->SetImplementationFlags( static_cast(MethodImplAttributes::PreserveSig | MethodImplAttributes::Runtime) );
-
- // Get the method implementation flags for the constructor.
- MethodImplAttributes myMethodAttributes = myConstructor->GetMethodImplementationFlags();
- Type^ myAttributeType = MethodImplAttributes::typeid;
- int myAttribValue = (int)myMethodAttributes;
- if ( !myAttributeType->IsEnum )
- {
- Console::WriteLine( "This is not an Enum" );
- }
-
- // Display the field info names of the retrieved method implementation flags.
- array^myFieldInfo = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) );
- Console::WriteLine( "The Field info names of the MethodImplAttributes for the constructor are:" );
- for ( int i = 0; i < myFieldInfo->Length; i++ )
- {
- int myFieldValue = *safe_cast(myFieldInfo[ i ]->GetValue( nullptr ));
- if ( (myFieldValue & myAttribValue) == myFieldValue )
- {
- Console::WriteLine( " {0}", myFieldInfo[ i ]->Name );
- }
- }
- //
-
- // Add a method to the type.
- myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr );
-
- // Generate IL for the method.
- ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator();
- myILGenerator2->EmitWriteLine( "Hello World from global" );
- myILGenerator2->Emit( OpCodes::Ret );
- myModuleBuilder->CreateGlobalFunctions();
- myType1 = myTypeBuilder->CreateType();
- }
- catch ( InvalidOperationException^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
- catch ( Exception^ ex )
- {
- Console::WriteLine( "The following exception has occurred : {0}", ex->Message );
- }
- }
-
- property Type^ MyTypeProperty
- {
- Type^ get()
- {
- return this->myType1;
- }
- }
-};
-
-void main()
-{
- MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder;
- Type^ myType1 = myConstructorBuilder->MyTypeProperty;
- if ( nullptr != myType1 )
- {
- Console::WriteLine( "Instantiating the new type..." );
- array^myObject = {"hello"};
- Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr );
- MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" );
- if ( nullptr != myMethodInfo )
- {
- Console::WriteLine( "Invoking dynamically created HelloWorld method..." );
- myMethodInfo->Invoke( myObject1, nullptr );
- }
- else
- {
- Console::WriteLine( "Could not locate HelloWorld method" );
- }
- }
- else
- {
- Console::WriteLine( "Could not access Type." );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp
deleted file mode 100644
index 16aca594b6f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// System.Reflection.Emit.ConstructorBuilder.SetSymCustomAttribute()
-
-/* The following program demonstrates the 'SetSymCustomAttribute' method
-of ConstructorBuilder class. It creates an assembly in the current
-domain with dynamic module in the assembly. Constructor builder is
-used in conjunction with the 'TypeBuilder' class to create constructor
-at run time. It then sets this constructor's custom attribute associated
-with symbolic information.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class MyConstructorBuilder
-{
-private:
- Type^ myType1;
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- MyConstructorBuilder()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
-
-//
- MethodBuilder^ myMethodBuilder = nullptr;
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
- // Create assembly in current CurrentDomain.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
- // Create a dynamic assembly.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::Run );
- // Create a dynamic module in the assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true );
- FieldInfo^ myFieldInfo =
- myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public );
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
- FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting",
- String::typeid, FieldAttributes::Public );
- array^ myConstructorArgs = {String::typeid};
- // Define a constructor of the dynamic class.
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
- // Display the name of the constructor.
- Console::WriteLine( "The constructor name is : {0}", myConstructor->Name );
- array^ temp0 = {01,00,00};
- myConstructor->SetSymCustomAttribute( "MySimAttribute", temp0 );
-//
- // Generate the IL for the method and call its superclass constructor.
- ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator();
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) );
- myILGenerator3->Emit( OpCodes::Call, myConstructorInfo );
- myILGenerator3->Emit( OpCodes::Ldarg_0 );
- myILGenerator3->Emit( OpCodes::Ldarg_1 );
- myILGenerator3->Emit( OpCodes::Stfld, myGreetingField );
- myILGenerator3->Emit( OpCodes::Ret );
- // Add a method to the type.
- myMethodBuilder = myTypeBuilder->DefineMethod(
- "HelloWorld", MethodAttributes::Public, nullptr, nullptr );
- // Generate IL for the method.
- ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator();
- myILGenerator2->EmitWriteLine( "Hello World from global" );
- myILGenerator2->Emit( OpCodes::Ret );
- myModuleBuilder->CreateGlobalFunctions();
- myType1 = myTypeBuilder->CreateType();
- }
-
- property Type^ MyTypeProperty
- {
- Type^ get()
- {
- return this->myType1;
- }
- }
-};
-
-int main()
-{
- MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder;
- Type^ myType1 = myConstructorBuilder->MyTypeProperty;
- if ( nullptr != myType1 )
- {
- Console::WriteLine( "Instantiating the new type..." );
- array^ myObject = {"hello"};
- Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr );
- MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" );
- if ( nullptr != myMethodInfo )
- {
- Console::WriteLine( "Invoking dynamically created HelloWorld method..." );
- myMethodInfo->Invoke( myObject1, nullptr );
- }
- else
- {
- Console::WriteLine( "Could not locate HelloWorld method" );
- }
- }
- else
- {
- Console::WriteLine( "Could not access Type." );
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp
deleted file mode 100644
index 95a1012b1d2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-// An enumeration used by the ExampleAttribute class.
-public enum class ExampleKind
-{
- FirstKind, SecondKind, ThirdKind, FourthKind
-};
-
-// An example attribute. The attribute can be applied to all
-// targets, from assemblies to parameters.
-//
-[AttributeUsage(AttributeTargets::All)]
-public ref class ExampleAttribute: public Attribute
-{
-private:
- // Data for properties.
- ExampleKind kindValue;
- String^ noteValue;
- array^ arrayStrings;
- array^ arrayNumbers;
-
- // Constructors.
- void ExampleAttributeInitialize( ExampleKind initKind, array^ initStrings )
- {
- kindValue = initKind;
- arrayStrings = initStrings;
- }
-public:
- ExampleAttribute()
- {
- ExampleAttributeInitialize( ExampleKind::FirstKind, nullptr );
- }
- ExampleAttribute( ExampleKind initKind )
- {
- ExampleAttributeInitialize( initKind, nullptr );
- }
- ExampleAttribute( ExampleKind initKind, array^ initStrings )
- {
- ExampleAttributeInitialize( initKind, initStrings );
- }
-
- // Properties. The Note and Numbers properties must be read/write, so they
- // can be used as named parameters.
- //
- property ExampleKind Kind
- {
- ExampleKind get()
- {
- return kindValue;
- }
- }
- property array^ Strings
- {
- array^ get()
- {
- return arrayStrings;
- }
- }
- property String^ Note
- {
- String^ get()
- {
- return noteValue;
- }
-
- void set( String^ value )
- {
- noteValue = value;
- }
- }
- property array^ Numbers
- {
- array^ get()
- {
- return arrayNumbers;
- }
-
- void set( array^ value )
- {
- arrayNumbers = value;
- }
- }
-};
-
-// The example attribute is applied to the assembly.
-[assembly:Example(ExampleKind::ThirdKind,Note="This is a note on the assembly.")];
-
-// The example attribute is applied to the test class.
-//
-[Example(ExampleKind::SecondKind,
- gcnew array { "String array argument, line 1",
- "String array argument, line 2",
- "String array argument, line 3" },
- Note="This is a note on the class.",
- Numbers = gcnew array { 53, 57, 59 })]
-public ref class Test
-{
-public:
- // The example attribute is applied to a method, using the
- // parameterless constructor and supplying a named argument.
- // The attribute is also applied to the method parameter.
- //
- [Example(Note="This is a note on a method.")]
- void TestMethod( [Example] Object^ arg ){}
-
- // Main() gets objects representing the assembly, the test
- // type, the test method, and the method parameter. Custom
- // attribute data is displayed for each of these.
- //
- static void Main()
- {
- Assembly^ assembly = Assembly::ReflectionOnlyLoad( "Source" );
- Type^ t = assembly->GetType( "Test" );
- MethodInfo^ m = t->GetMethod( "TestMethod" );
- array^p = m->GetParameters();
-
- Console::WriteLine( "\r\nAttributes for assembly: '{0}'", assembly );
- ShowAttributeData( CustomAttributeData::GetCustomAttributes( assembly ) );
- Console::WriteLine( "\r\nAttributes for type: '{0}'", t );
- ShowAttributeData( CustomAttributeData::GetCustomAttributes( t ) );
- Console::WriteLine( "\r\nAttributes for member: '{0}'", m );
- ShowAttributeData( CustomAttributeData::GetCustomAttributes( m ) );
- Console::WriteLine( "\r\nAttributes for parameter: '{0}'", p );
- ShowAttributeData( CustomAttributeData::GetCustomAttributes( p[ 0 ] ) );
- }
-
-private:
- static void ShowValueOrArray(CustomAttributeTypedArgument^ cata)
- {
- if (cata->Value->GetType() == ReadOnlyCollection::typeid)
- {
- Console::WriteLine(" Array of '{0}':", cata->ArgumentType);
-
- for each (CustomAttributeTypedArgument^ cataElement in
- (ReadOnlyCollection^) cata->Value)
- {
- Console::WriteLine(" Type: '{0}' Value: '{1}'",
- cataElement->ArgumentType, cataElement->Value);
- }
- }
- else
- {
- Console::WriteLine( " Type: '{0}' Value: '{1}'",
- cata->ArgumentType, cata->Value );
- }
- }
-
- static void ShowAttributeData( IList< CustomAttributeData^ >^ attributes )
- {
- for each ( CustomAttributeData^ cad in attributes )
- {
- Console::WriteLine( " {0}", cad );
- Console::WriteLine( " Constructor: '{0}'", cad->Constructor );
-
- Console::WriteLine( " Constructor arguments:" );
- for each ( CustomAttributeTypedArgument^ cata in cad->ConstructorArguments )
- {
- ShowValueOrArray(cata);
- }
-
- Console::WriteLine( " Named arguments:" );
- for each ( CustomAttributeNamedArgument cana in cad->NamedArguments )
- {
- Console::WriteLine( " MemberInfo: '{0}'", cana.MemberInfo );
- ShowValueOrArray(cana.TypedValue);
- }
- }
- }
-};
-
-int main()
-{
- Test::Main();
-}
-
-/* This code example produces output similar to the following:
-
-Attributes for assembly: 'source, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
- [System.Runtime.CompilerServices.CompilationRelaxationsAttribute((Int32)8)]
- Constructor: 'Void .ctor(Int32)'
- Constructor arguments:
- Type: 'System.Int32' Value: '8'
- Named arguments:
- [System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows = True)]
- Constructor: 'Void .ctor()'
- Constructor arguments:
- Named arguments:
- MemberInfo: 'Boolean WrapNonExceptionThrows'
- Type: 'System.Boolean' Value: 'True'
- [ExampleAttribute((ExampleKind)2, Note = "This is a note on the assembly.")]
- Constructor: 'Void .ctor(ExampleKind)'
- Constructor arguments:
- Type: 'ExampleKind' Value: '2'
- Named arguments:
- MemberInfo: 'System.String Note'
- Type: 'System.String' Value: 'This is a note on the assembly.'
-
-Attributes for type: 'Test'
- [ExampleAttribute((ExampleKind)1, new String[3] { "String array argument, line 1", "String array argument, line 2", "String array argument, line 3" }, Note = "This is a note on the class.", Numbers = new Int32[3] { 53, 57, 59 })]
- Constructor: 'Void .ctor(ExampleKind, System.String[])'
- Constructor arguments:
- Type: 'ExampleKind' Value: '1'
- Array of 'System.String[]':
- Type: 'System.String' Value: 'String array argument, line 1'
- Type: 'System.String' Value: 'String array argument, line 2'
- Type: 'System.String' Value: 'String array argument, line 3'
- Named arguments:
- MemberInfo: 'System.String Note'
- Type: 'System.String' Value: 'This is a note on the class.'
- MemberInfo: 'Int32[] Numbers'
- Array of 'System.Int32[]':
- Type: 'System.Int32' Value: '53'
- Type: 'System.Int32' Value: '57'
- Type: 'System.Int32' Value: '59'
-
-Attributes for member: 'Void TestMethod(System.Object)'
- [ExampleAttribute(Note = "This is a note on a method.")]
- Constructor: 'Void .ctor()'
- Constructor arguments:
- Named arguments:
- MemberInfo: 'System.String Note'
- Type: 'System.String' Value: 'This is a note on a method.'
-
-Attributes for parameter: 'System.Object arg'
- [ExampleAttribute()]
- Constructor: 'Void .ctor()'
- Constructor arguments:
- Named arguments:
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp
deleted file mode 100644
index 0ee3bf8e579..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-void main()
-{
- String^ name = "InMemory";
-
- AssemblyBuilder^ asmBldr =
- AppDomain::CurrentDomain->DefineDynamicAssembly(gcnew AssemblyName(name),
- AssemblyBuilderAccess::Run);
- ModuleBuilder^ modBldr = asmBldr->DefineDynamicModule(name);
-
- TypeBuilder^ tb = modBldr->DefineType("DemoVararg");
-
- // Create a vararg method with no return value and one
- // string argument. (The string argument type is the only
- // element of an array of Type objects.)
- //
- MethodBuilder^ mb1 = tb->DefineMethod("VarargMethod",
- MethodAttributes::Public | MethodAttributes::Static,
- CallingConventions::VarArgs,
- nullptr,
- gcnew array { String::typeid });
-
- ILGenerator^ il1 = mb1->GetILGenerator();
-
- LocalBuilder^ locAi = il1->DeclareLocal(ArgIterator::typeid);
- LocalBuilder^ locNext = il1->DeclareLocal(bool::typeid);
-
- Label labelCheckCondition = il1->DefineLabel();
- Label labelNext = il1->DefineLabel();
-
- // Load the fixed argument and print it.
- il1->Emit(OpCodes::Ldarg_0);
- il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write",
- gcnew array { String::typeid }));
-
- // Load the address of the local variable represented by
- // locAi, which will hold the ArgIterator.
- il1->Emit(OpCodes::Ldloca_S, locAi);
-
- // Load the address of the argument list, and call the
- // ArgIterator constructor that takes an array of runtime
- // argument handles.
- il1->Emit(OpCodes::Arglist);
- il1->Emit(OpCodes::Call, ArgIterator::typeid->GetConstructor(
- gcnew array { RuntimeArgumentHandle::typeid }));
-
- // Enter the loop at the point where the remaining argument
- // count is tested.
- il1->Emit(OpCodes::Br_S, labelCheckCondition);
-
- // At the top of the loop, call GetNextArg to get the next
- // argument from the ArgIterator. Convert the typed reference
- // to an object reference and write the object to the console.
- il1->MarkLabel(labelNext);
- il1->Emit(OpCodes::Ldloca_S, locAi);
- il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetNextArg", Type::EmptyTypes));
- il1->Emit(OpCodes::Call, TypedReference::typeid->GetMethod("ToObject"));
- il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write",
- gcnew array { Object::typeid }));
-
- il1->MarkLabel(labelCheckCondition);
- il1->Emit(OpCodes::Ldloca_S, locAi);
- il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetRemainingCount"));
-
- // If the remaining count is greater than zero, go to
- // the top of the loop.
- il1->Emit(OpCodes::Ldc_I4_0);
- il1->Emit(OpCodes::Cgt);
- il1->Emit(OpCodes::Stloc_1);
- il1->Emit(OpCodes::Ldloc_1);
- il1->Emit(OpCodes::Brtrue_S, labelNext);
-
- il1->Emit(OpCodes::Ret);
-
- // Create a method that contains a call to the vararg
- // method.
- MethodBuilder^ mb2 = tb->DefineMethod("CallVarargMethod",
- MethodAttributes::Public | MethodAttributes::Static,
- CallingConventions::Standard,
- nullptr, Type::EmptyTypes);
-
- ILGenerator^ il2 = mb2->GetILGenerator();
-
- // Push arguments on the stack: one for the fixed string
- // parameter, and two for the list.
- il2->Emit(OpCodes::Ldstr, "Hello ");
- il2->Emit(OpCodes::Ldstr, "world ");
- il2->Emit(OpCodes::Ldc_I4, 2006);
-
- // Call the vararg method, specifying the types of the
- // arguments in the list.
- il2->EmitCall(OpCodes::Call, mb1,
- gcnew array { String::typeid, int::typeid });
-
- il2->Emit(OpCodes::Ret);
-
- Type^ type = tb->CreateType();
- type->GetMethod("CallVarargMethod")->Invoke(nullptr, nullptr);
-}
-
-/* This code example produces the following output:
-
-Hello world 2006
- */
-//
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp
deleted file mode 100644
index e0695468622..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Collections::Generic;
-
-// Dummy class to satisfy TFirst constraints.
-//
-public ref class Example {};
-
-// Define a trivial base class and two trivial interfaces
-// to use when demonstrating constraints.
-//
-public ref class ExampleBase {};
-public interface class IExampleA {};
-public interface class IExampleB {};
-
-// Define a trivial type that can substitute for type parameter
-// TSecond.
-//
-public ref class ExampleDerived : ExampleBase, IExampleA, IExampleB {};
-
-// List the constraint flags. The GenericParameterAttributes
-// enumeration contains two sets of attributes, variance and
-// constraints. For this example, only constraints are used.
-//
-static void ListConstraintAttributes( Type^ t )
-{
- // Mask off the constraint flags.
- GenericParameterAttributes constraints =
- t->GenericParameterAttributes &
- GenericParameterAttributes::SpecialConstraintMask;
-
- if ((constraints & GenericParameterAttributes::ReferenceTypeConstraint)
- != GenericParameterAttributes::None)
- Console::WriteLine( L" ReferenceTypeConstraint");
-
- if ((constraints & GenericParameterAttributes::NotNullableValueTypeConstraint)
- != GenericParameterAttributes::None)
- Console::WriteLine( L" NotNullableValueTypeConstraint");
-
- if ((constraints & GenericParameterAttributes::DefaultConstructorConstraint)
- != GenericParameterAttributes::None)
- Console::WriteLine( L" DefaultConstructorConstraint");
-}
-
-static void DisplayGenericParameters( Type^ t )
-{
- if (!t->IsGenericType)
- {
- Console::WriteLine( L"Type '{0}' is not generic." );
- return;
- }
- if (!t->IsGenericTypeDefinition)
- t = t->GetGenericTypeDefinition();
-
- array^ typeParameters = t->GetGenericArguments();
- Console::WriteLine( L"\r\nListing {0} type parameters for type '{1}'.",
- typeParameters->Length, t );
-
- for each ( Type^ tParam in typeParameters )
- {
- Console::WriteLine( L"\r\nType parameter {0}:",
- tParam->ToString() );
-
- for each (Type^ c in tParam->GetGenericParameterConstraints())
- {
- if (c->IsInterface)
- Console::WriteLine( L" Interface constraint: {0}", c);
- else
- Console::WriteLine( L" Base type constraint: {0}", c);
- }
- ListConstraintAttributes(tParam);
- }
-}
-
-void main()
-{
- // Define a dynamic assembly to contain the sample type. The
- // assembly will be run and also saved to disk, so
- // AssemblyBuilderAccess.RunAndSave is specified.
- //
- //
- AppDomain^ myDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAsmName = gcnew AssemblyName( L"GenericEmitExample1" );
- AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly(
- myAsmName, AssemblyBuilderAccess::RunAndSave );
- //
-
- // An assembly is made up of executable modules. For a single-
- // module assembly, the module name and file name are the same
- // as the assembly name.
- //
- //
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule(
- myAsmName->Name, String::Concat( myAsmName->Name, L".dll" ) );
- //
-
- // Get type objects for the base class trivial interfaces to
- // be used as constraints.
- //
- Type^ baseType = ExampleBase::typeid;
- Type^ interfaceA = IExampleA::typeid;
- Type^ interfaceB = IExampleB::typeid;
-
- // Define the sample type.
- //
- //
- TypeBuilder^ myType = myModule->DefineType( L"Sample",
- TypeAttributes::Public );
- //
-
- Console::WriteLine( L"Type 'Sample' is generic: {0}",
- myType->IsGenericType );
-
- // Define type parameters for the type. Until you do this,
- // the type is not generic, as the preceding and following
- // WriteLine statements show. The type parameter names are
- // specified as an array of strings. To make the code
- // easier to read, each GenericTypeParameterBuilder is placed
- // in a variable with the same name as the type parameter.
- //
- //
- array^typeParamNames = {L"TFirst",L"TSecond"};
- array^typeParams =
- myType->DefineGenericParameters( typeParamNames );
-
- GenericTypeParameterBuilder^ TFirst = typeParams[0];
- GenericTypeParameterBuilder^ TSecond = typeParams[1];
- //
-
- Console::WriteLine( L"Type 'Sample' is generic: {0}",
- myType->IsGenericType );
-
- // Apply constraints to the type parameters.
- //
- // A type that is substituted for the first parameter, TFirst,
- // must be a reference type and must have a parameterless
- // constructor.
- //
- TFirst->SetGenericParameterAttributes(
- GenericParameterAttributes::DefaultConstructorConstraint |
- GenericParameterAttributes::ReferenceTypeConstraint
- );
- //
-
- // A type that is substituted for the second type
- // parameter must implement IExampleA and IExampleB, and
- // inherit from the trivial test class ExampleBase. The
- // interface constraints are specified as an array
- // containing the interface types.
- //
- array^interfaceTypes = { interfaceA, interfaceB };
- TSecond->SetInterfaceConstraints( interfaceTypes );
- TSecond->SetBaseTypeConstraint( baseType );
- //
-
- // The following code adds a private field named ExampleField,
- // of type TFirst.
- //
- FieldBuilder^ exField =
- myType->DefineField("ExampleField", TFirst,
- FieldAttributes::Private);
- //
-
- // Define a static method that takes an array of TFirst and
- // returns a List containing all the elements of
- // the array. To define this method it is necessary to create
- // the type List by calling MakeGenericType on the
- // generic type definition, generic List.
- // The parameter type is created by using the
- // MakeArrayType method.
- //
- //
- Type^ listOf = List::typeid;
- Type^ listOfTFirst = listOf->MakeGenericType(TFirst);
- array^ mParamTypes = { TFirst->MakeArrayType() };
-
- MethodBuilder^ exMethod =
- myType->DefineMethod("ExampleMethod",
- MethodAttributes::Public | MethodAttributes::Static,
- listOfTFirst,
- mParamTypes);
- //
-
- // Emit the method body.
- // The method body consists of just three opcodes, to load
- // the input array onto the execution stack, to call the
- // List constructor that takes IEnumerable,
- // which does all the work of putting the input elements into
- // the list, and to return, leaving the list on the stack. The
- // hard work is getting the constructor.
- //
- // The GetConstructor method is not supported on a
- // GenericTypeParameterBuilder, so it is not possible to get
- // the constructor of List directly. There are two
- // steps, first getting the constructor of generic List and then
- // calling a method that converts it to the corresponding
- // constructor of List.
- //
- // The constructor needed here is the one that takes an
- // IEnumerable. Note, however, that this is not the
- // generic type definition of generic IEnumerable; instead, the
- // T from generic List must be substituted for the T of
- // generic IEnumerable. (This seems confusing only because both
- // types have type parameters named T. That is why this example
- // uses the somewhat silly names TFirst and TSecond.) To get
- // the type of the constructor argument, take the generic
- // type definition generic IEnumerable and
- // call MakeGenericType with the first generic type parameter
- // of generic List. The constructor argument list must be passed
- // as an array, with just one argument in this case.
- //
- // Now it is possible to get the constructor of generic List,
- // using GetConstructor on the generic type definition. To get
- // the constructor of List, pass List and
- // the constructor from generic List to the static
- // TypeBuilder.GetConstructor method.
- //
- //
- ILGenerator^ ilgen = exMethod->GetILGenerator();
-
- Type^ ienumOf = IEnumerable::typeid;
- Type^ TfromListOf = listOf->GetGenericArguments()[0];
- Type^ ienumOfT = ienumOf->MakeGenericType(TfromListOf);
- array^ ctorArgs = {ienumOfT};
-
- ConstructorInfo^ ctorPrep = listOf->GetConstructor(ctorArgs);
- ConstructorInfo^ ctor =
- TypeBuilder::GetConstructor(listOfTFirst, ctorPrep);
-
- ilgen->Emit(OpCodes::Ldarg_0);
- ilgen->Emit(OpCodes::Newobj, ctor);
- ilgen->Emit(OpCodes::Ret);
- //
-
- // Create the type and save the assembly.
- //
- Type^ finished = myType->CreateType();
- myAssembly->Save( String::Concat( myAsmName->Name, L".dll" ) );
- //
-
- // Invoke the method.
- // ExampleMethod is not generic, but the type it belongs to is
- // generic, so in order to get a MethodInfo that can be invoked
- // it is necessary to create a constructed type. The Example
- // class satisfies the constraints on TFirst, because it is a
- // reference type and has a default constructor. In order to
- // have a class that satisfies the constraints on TSecond,
- // this code example defines the ExampleDerived type. These
- // two types are passed to MakeGenericMethod to create the
- // constructed type.
- //
- //
- array^ typeArgs =
- { Example::typeid, ExampleDerived::typeid };
- Type^ constructed = finished->MakeGenericType(typeArgs);
- MethodInfo^ mi = constructed->GetMethod("ExampleMethod");
- //
-
- // Create an array of Example objects, as input to the generic
- // method. This array must be passed as the only element of an
- // array of arguments. The first argument of Invoke is
- // null, because ExampleMethod is static. Display the count
- // on the resulting List.
- //
- //
- array^ input = { gcnew Example(), gcnew Example() };
- array^ arguments = { input };
-
- List^ listX =
- (List^) mi->Invoke(nullptr, arguments);
-
- Console::WriteLine(
- "\nThere are {0} elements in the List.",
- listX->Count);
- //
-
- DisplayGenericParameters(finished);
-}
-
-/* This code example produces the following output:
-
-Type 'Sample' is generic: False
-Type 'Sample' is generic: True
-
-There are 2 elements in the List.
-
-Listing 2 type parameters for type 'Sample[TFirst,TSecond]'.
-
-Type parameter TFirst:
- ReferenceTypeConstraint
- DefaultConstructorConstraint
-
-Type parameter TSecond:
- Interface constraint: IExampleA
- Interface constraint: IExampleB
- Base type constraint: ExampleBase
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp
deleted file mode 100644
index 47c3f438a04..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-// System.Reflection.Emit.EnumBuilder.TypeToken
-// System.Reflection.Emit.EnumBuilder.UnderlyingField
-// System.Reflection.Emit.EnumBuilder.UnderlyingSystemType
-// System.Reflection.Emit.EnumBuilder.GUID
-/* The following program demonstrates 'TypeToken', 'UnderlyingField',
- 'UnderlyingSystemType' and ''GUID' properties of
- 'System.Reflection.Emit.EnumBuilder' class. This example defines
- a class 'MyEnumBuilderSample'. The main function calls the CreateCalle
- method in which the 'EnumBuilder' class and its fields are constructed.
- The output of the 'EnumBuilder' properties are displayed on the console
- in the main method. */
-//
-//
-//
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-public ref class MyEnumBuilderSample
-{
-private:
- static AssemblyBuilder^ myAssemblyBuilder;
- static ModuleBuilder^ myModuleBuilder;
- static EnumBuilder^ myEnumBuilder;
-
-public:
- static void Main()
- {
- try
- {
- CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save );
- array^myTypeArray = myModuleBuilder->GetTypes();
- IEnumerator^ myEnum = myTypeArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ myType = safe_cast(myEnum->Current);
- Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name );
- }
- Console::WriteLine( "Enum TypeToken is :{0}", myEnumBuilder->TypeToken );
- Console::WriteLine( "Enum UnderLyingField is :{0}", myEnumBuilder->UnderlyingField );
- Console::WriteLine( "Enum UnderLyingSystemType is :{0}", myEnumBuilder->UnderlyingSystemType );
- Console::WriteLine( "Enum GUID is :{0}", myEnumBuilder->GUID );
- myAssemblyBuilder->Save( "EmittedAssembly.dll" );
- }
- catch ( NotSupportedException^ ex )
- {
- Console::WriteLine( "The following is the exception is raised: {0}", ex->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following is the exception raised: {0}", e->Message );
- }
- }
-
-
-private:
- static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ )
- {
- // Create a name for the assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the dynamic assembly.
- myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );
-
- // Create a dynamic module.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
-
- // Create a dynamic Enum.
- myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid );
- FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 );
- FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 );
- myEnumBuilder->CreateType();
- }
-};
-
-int main()
-{
- MyEnumBuilderSample::Main();
-}
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp
deleted file mode 100644
index e210b66486f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-
-// System.Reflection.Emit.EnumBuilder.Assembly
-// System.Reflection.Emit.EnumBuilder.AssemblyQualifiedName
-// System.Reflection.Emit.EnumBuilder.Module
-// System.Reflection.Emit.EnumBuilder.Name
-// System.Reflection.Emit.EnumBuilder.Namespace
-/* The following program demonstrates 'Assembly', 'AssemblyQualifiedName',
- 'Module', 'Name' and 'Namespace' properties of
- 'System.Reflection.Emit.EnumBuilder' class. This example defines a
- class 'MyEnumBuilderSample'. The main function calls the CreateCalle
- method in which the 'EnumBuilder' class and its fields are constructed.
- The output of the 'EnumBuilder' properties are displayed on the console
- in the main method. */
-//
-//
-//
-//
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class MyEnumBuilderSample
-{
-private:
- static AssemblyBuilder^ myAssemblyBuilder;
- static ModuleBuilder^ myModuleBuilder;
- static EnumBuilder^ myEnumBuilder;
-
-public:
- static void Main()
- {
- try
- {
- CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save );
- array^myTypeArray = myModuleBuilder->GetTypes();
- IEnumerator^ myEnum = myTypeArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ myType = safe_cast(myEnum->Current);
- Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name );
- }
- Console::WriteLine( "Properties of EnumBuilder : " );
- Console::WriteLine( "Enum Assembly is :{0}", myEnumBuilder->Assembly );
- Console::WriteLine( "Enum AssemblyQualifiedName is :{0}", myEnumBuilder->AssemblyQualifiedName );
- Console::WriteLine( "Enum Module is :{0}", myEnumBuilder->Module );
- Console::WriteLine( "Enum Name is :{0}", myEnumBuilder->Name );
- Console::WriteLine( "Enum NameSpace is :{0}", myEnumBuilder->Namespace );
- myAssemblyBuilder->Save( "EmittedAssembly.dll" );
- }
- catch ( NotSupportedException^ ex )
- {
- Console::WriteLine( "The following is the exception is raised: {0}", ex->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following is the exception raised: {0}", e->Message );
- }
- }
-
-private:
- static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ )
- {
- // Create a name for the assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the dynamic assembly.
- myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );
-
- // Create a dynamic module.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
-
- // Create a dynamic Enum.
- myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid );
- FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 );
- FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 );
- myEnumBuilder->CreateType();
- }
-};
-
-int main()
-{
- MyEnumBuilderSample::Main();
-}
-//
-//
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp
deleted file mode 100644
index 6fa6db382ff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-// System.Reflection.Emit.EnumBuilder
-// System.Reflection.Emit.EnumBuilder.IsDefined()
-// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(Type, bool)
-// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(CustomAttributeBuilder)
-/*
- The following program demonstrates the EnumBuilder class and
- its methods 'IsDefined', 'GetCustomAttributes(Type, bool)' and
- 'SetCustomAttribute(CustomAttributeBuilder)'. It defines a 'MyAttribute'
- class which is derived from 'System.Attribute' class. It builds an Enum
- and sets 'MyAttribute' as custom attribute to the Enum. It gets the
- custom attributes of the Enum type and displays its contents on the console.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-//
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- String^ myString;
- int myInteger;
- MyAttribute( String^ myString1, int myInteger1 )
- {
- this->myString = myString1;
- this->myInteger = myInteger1;
- }
-
-};
-
-ref class MyApplication
-{
-private:
- static AssemblyBuilder^ myAssemblyBuilder;
- static EnumBuilder^ myEnumBuilder;
-
-public:
- static void Main()
- {
- try
- {
- CreateCallee( Thread::GetDomain() );
- if ( myEnumBuilder->IsDefined( MyAttribute::typeid, false ) )
- {
- array^myAttributesArray = myEnumBuilder->GetCustomAttributes( MyAttribute::typeid, false );
- Console::WriteLine( "Custom attribute contains: " );
-
- // Read the attributes and display them on the console.
- for ( int index = 0; index < myAttributesArray->Length; index++ )
- {
- if ( dynamic_cast(myAttributesArray[ index ]) )
- {
- Console::WriteLine( "The value of myString is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myString );
- Console::WriteLine( "The value of myInteger is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myInteger );
- }
- }
- }
- else
- {
- Console::WriteLine( "Custom Attributes are not set for the EnumBuilder" );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception is raised:{0}", e->Message );
- }
-
- }
-
-private:
- static void CreateCallee( AppDomain^ domain )
- {
- // Create a name for the assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the dynamic assembly.
- myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
- Type^ myType = MyAttribute::typeid;
- array^temp0 = {String::typeid,int::typeid};
- ConstructorInfo^ myInfo = myType->GetConstructor( temp0 );
- array^temp1 = {"Hello",2};
- CustomAttributeBuilder^ myCustomAttributeBuilder = gcnew CustomAttributeBuilder( myInfo,temp1 );
-
- // Create a dynamic module.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" );
-
- // Create a dynamic Enum.
- myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid );
- FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 );
- FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 );
- myEnumBuilder->CreateType();
- myEnumBuilder->SetCustomAttribute( myCustomAttributeBuilder );
- }
-};
-
-int main()
-{
- MyApplication::Main();
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp
deleted file mode 100644
index 2e1b90bdfc9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-
-// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(bool)
-// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(ConstructorInfo, byte[])
-/*
- The following program demonstrates 'GetCustomAttributes(bool)'
- and 'SetCustomAttribute(ConstructorInfo, byte[])' methods of
- 'System.Reflection.Emit.EnumBuilder' class. It defines 'MyAttribute'
- class which is derived from 'System.Attribute' class. It builds an
- Enum and sets 'MyAttribute' as custom attribute to the Enum.
- It gets the custom attributes of the Enum type and displays its contents
- on the console.
-*/
-//
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute: public Attribute
-{
-public:
- bool myBoolValue;
- MyAttribute( bool myBool )
- {
- this->myBoolValue = myBool;
- }
-};
-
-ref class MyApplication
-{
-private:
- static EnumBuilder^ myEnumBuilder;
-
-public:
- static void Main()
- {
- try
- {
- CreateCallee( Thread::GetDomain() );
- array^myAttributesArray = myEnumBuilder->GetCustomAttributes( true );
-
- // Read the attributes and display them on the console.
- Console::WriteLine( "Custom attribute contains: " );
- for ( int index = 0; index < myAttributesArray->Length; index++ )
- {
- if ( dynamic_cast(myAttributesArray[ index ]) )
- {
- Console::WriteLine( "myBoolValue: {0}", (dynamic_cast(myAttributesArray[ index ]))->myBoolValue );
- }
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception is raised:{0}", e->Message );
- }
-
- }
-
-private:
- static void CreateCallee( AppDomain^ domain )
- {
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
-
- // Create a name for the assembly.
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the dynamic assembly.
- AssemblyBuilder^ myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
- Type^ myType = MyAttribute::typeid;
- array^temp0 = {bool::typeid};
- ConstructorInfo^ myInfo = myType->GetConstructor( temp0 );
-
- // Create a dynamic module.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" );
-
- // Create a dynamic Enum.
- myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid );
- FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 );
- FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 );
- myEnumBuilder->CreateType();
- array^temp1 = {01,00,01};
- myEnumBuilder->SetCustomAttribute( myInfo, temp1 );
- }
-};
-
-int main()
-{
- MyApplication::Main();
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp b/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp
deleted file mode 100644
index 1b826c1f2bc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-// The following example uses instances of classes in
-// the System::Reflection namespace to discover an event argument type.
-using namespace System;
-using namespace System::Reflection;
-
-public delegate void MyDelegate( int i );
-public ref class MainClass
-{
-public:
- event MyDelegate^ ev;
-};
-
-int main()
-{
- Type^ delegateType = MainClass::typeid->GetEvent( "ev" )->EventHandlerType;
- MethodInfo^ invoke = delegateType->GetMethod( "Invoke" );
- array^pars = invoke->GetParameters();
- System::Collections::IEnumerator^ myEnum = pars->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- ParameterInfo^ p = safe_cast(myEnum->Current);
- Console::WriteLine( p->ParameterType );
- }
-}
-// The example displays the following output:
-// System.Int32
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp
deleted file mode 100644
index 8b038438f4b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-
-// System::Reflection::Emit::FieldBuilder.ReflectedType
-// System::Reflection::Emit::FieldBuilder.Attributes
-/*
- The following example demonstrates 'ReflectedType' and 'Attributes'
- properties of 'FieldBuilder' class.A new class 'MyClass' is created.
- A Field and a method are defined in the class.In the constructor of the class
- the field is initialized.Method of the class gets the value of the Field.
- An instance of the class is created and method is invoked.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ CreateType( AppDomain^ currentDomain )
-{
- // Create an assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "DynamicAssembly";
- AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module in Dynamic Assembly.
- ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule" );
-
- // Define a public class named S"MyClass" in the assembly.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public );
-
- // Define a private String field named S"MyField" in the type.
- FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, static_cast(FieldAttributes::Private | FieldAttributes::Static) );
-
- // Create the constructor.
- array^constructorArgs = {String::typeid};
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs );
- ILGenerator^ constructorIL = myConstructor->GetILGenerator();
- constructorIL->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) );
- constructorIL->Emit( OpCodes::Call, superConstructor );
- constructorIL->Emit( OpCodes::Ldarg_0 );
- constructorIL->Emit( OpCodes::Ldarg_1 );
- constructorIL->Emit( OpCodes::Stfld, myFieldBuilder );
- constructorIL->Emit( OpCodes::Ret );
-
- // Create the MyMethod method.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, String::typeid, nullptr );
- ILGenerator^ methodIL = myMethodBuilder->GetILGenerator();
- methodIL->Emit( OpCodes::Ldarg_0 );
- methodIL->Emit( OpCodes::Ldfld, myFieldBuilder );
- methodIL->Emit( OpCodes::Ret );
- if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static ) )
- {
- Console::WriteLine( "Field attribute defined as Static" );
- }
- else
- if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static | FieldAttributes::Private ) )
- {
- Console::WriteLine( "Field attributes are Static and Private" );
- }
-
-
- Console::WriteLine( "ReflectedType of Field is : {0}", myFieldBuilder->ReflectedType );
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- try
- {
- Type^ myType = CreateType( Thread::GetDomain() );
-
- // Create an instance of the S"HelloWorld" class.
- array^type = {"HelloWorld"};
- Object^ helloWorld = Activator::CreateInstance( myType, type );
-
- // Invoke the S"MyMethod" of the S"MyClass".
- Object^ myObject = myType->InvokeMember( "MyMethod", BindingFlags::InvokeMethod, nullptr, helloWorld, nullptr );
- Console::WriteLine( "MyClass::MyMethod returned: \"{0}\"", myObject );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Caught {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp
deleted file mode 100644
index fab865dd934..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-
-// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[])
-// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(CustomAttributeBuilder)
-/*
- The following program demonstrates 'SetCustomAttribute(ConstructorInfo, Byte[])'
- and 'SetCustomAttribute(CustomAttributeBuilder)' methods of 'FieldBuilder' class.
- A dynamic assembly is created. A new class of type 'MyClass' is created.
- A 'Method' and a 'Field are defined in the class.Two 'CustomAttributes' are
- set to the field. The method initializes a value to 'Field'.Value of the field
- is displayed to console.Values of Attributes applied to field are retrieved and
- displayed to console.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute1: public Attribute
-{
-public:
- String^ myCustomAttributeValue;
- MyAttribute1( String^ myString )
- {
- myCustomAttributeValue = myString;
- }
-};
-
-
-[AttributeUsage(AttributeTargets::All,AllowMultiple=false)]
-public ref class MyAttribute2: public Attribute
-{
-public:
- bool myCustomAttributeValue;
- MyAttribute2( bool myBool )
- {
- myCustomAttributeValue = myBool;
- }
-};
-
-Type^ CreateCallee( AppDomain^ currentDomain )
-{
- // Create a simple name for the assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the called dynamic assembly.
- AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
-
- // Define a public class named 'CustomClass' in the assembly.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "CustomClass", TypeAttributes::Public );
-
- // Define a private String field named 'MyField' in the type.
- FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, FieldAttributes::Public );
- Type^ myAttributeType1 = MyAttribute1::typeid;
-
- // Create a Constructorinfo Object* for attribute 'MyAttribute1'.
- array^type1 = {String::typeid};
- ConstructorInfo^ myConstructorInfo = myAttributeType1->GetConstructor( type1 );
-
- // Create the CustomAttribute instance of attribute of type 'MyAttribute1'.
- array^obj1 = {"Test"};
- CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 );
-
- // Set the CustomAttribute 'MyAttribute1' to the Field.
- myFieldBuilder->SetCustomAttribute( attributeBuilder );
- Type^ myAttributeType2 = MyAttribute2::typeid;
-
- // Create a Constructorinfo Object* for attribute 'MyAttribute2'.
- array^type2 = {bool::typeid};
- ConstructorInfo^ myConstructorInfo2 = myAttributeType2->GetConstructor( type2 );
-
- // Set the CustomAttribute 'MyAttribute2' to the Field.
- array^bytes = {01,00,01,00,00};
- myFieldBuilder->SetCustomAttribute( myConstructorInfo2, bytes );
-
- // Create a method.
- array^type3 = {String::typeid,int::typeid};
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, nullptr, type3 );
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
- myILGenerator->Emit( OpCodes::Ldarg_0 );
- myILGenerator->Emit( OpCodes::Ldarg_1 );
- myILGenerator->Emit( OpCodes::Stfld, myFieldBuilder );
- myILGenerator->EmitWriteLine( "Value of the Field is :" );
- myILGenerator->EmitWriteLine( myFieldBuilder );
- myILGenerator->Emit( OpCodes::Ret );
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- try
- {
- Type^ myCustomClass = CreateCallee( Thread::GetDomain() );
-
- // Construct an instance of a type.
- Object^ myObject = Activator::CreateInstance( myCustomClass );
- Console::WriteLine( "FieldBuilder Sample" );
-
- // Find a method in this type and call it on this Object*.
- MethodInfo^ myMethodInfo = myCustomClass->GetMethod( "MyMethod" );
- array^obj1 = {"Sample string",3};
- myMethodInfo->Invoke( myObject, obj1 );
-
- // Retrieve the values of Attributes applied to field and display to console.
- array^myFieldInfo = myCustomClass->GetFields();
- for ( int i = 0; i < myFieldInfo->Length; i++ )
- {
- array^attributes = myFieldInfo[ i ]->GetCustomAttributes( true );
- for ( int index = 0; index < attributes->Length; index++ )
- {
- if ( dynamic_cast(attributes[ index ]) )
- {
- MyAttribute1^ myCustomAttribute = safe_cast(attributes[ index ]);
- Console::WriteLine( "Attribute Value of (MyAttribute1): {0}", myCustomAttribute->myCustomAttributeValue );
- }
- if ( dynamic_cast(attributes[ index ]) )
- {
- MyAttribute2^ myCustomAttribute = safe_cast(attributes[ index ]);
- Console::WriteLine( "Attribute Value of (MyAttribute2): {0}", myCustomAttribute->myCustomAttributeValue );
- }
- }
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Caught {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp
deleted file mode 100644
index 0fe41fc175c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-
-// System::Reflection::Emit::FieldBuilder.SetOffset
-// System::Reflection::Emit::FieldBuilder.SetMarshal
-/*
- The following program demonstrates 'SetOffset' and 'SetMarshal'
- methods of 'FieldBuilder' class.A new Class is defined and a
- 'PInvoke' method 'OpenFile' method of 'Kernel32.dll' is defined
- in the class.Instance of the class is created and the method is invoked.
- To execute this program, make sure a file named 'MyFile.txt' should be there
- in the current directory.
-*/
-//
-using namespace System;
-using namespace System::Runtime::InteropServices;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Runtime::CompilerServices;
-Type^ CreateType( AppDomain^ currentDomain )
-{
- // Create an assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "DynamicAssembly";
- AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in Dynamic Assembly.
- ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule", "MyModule.mod" );
-
- // Define a public class named S"MyClass" in the assembly.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public );
- TypeBuilder^ myTypeBuilder2 = myModuleBuilder->DefineType( "MyClass2", static_cast(TypeAttributes::Public | TypeAttributes::BeforeFieldInit | TypeAttributes::SequentialLayout | TypeAttributes::AnsiClass | TypeAttributes::Sealed) );
- FieldBuilder^ myFieldBuilder1 = myTypeBuilder2->DefineField( "myBytes1", Byte::typeid, FieldAttributes::Public );
- FieldBuilder^ myFieldBuilder2 = myTypeBuilder2->DefineField( "myBytes2", Byte::typeid, FieldAttributes::Public );
- FieldBuilder^ myFieldBuilder3 = myTypeBuilder2->DefineField( "myErrorCode", short::typeid, FieldAttributes::Public );
- FieldBuilder^ myFieldBuilder4 = myTypeBuilder2->DefineField( "myReserved1", short::typeid, FieldAttributes::Public );
- FieldBuilder^ myFieldBuilder5 = myTypeBuilder2->DefineField( "myReserved2", short::typeid, FieldAttributes::Public );
- FieldBuilder^ myFieldBuilder6 = myTypeBuilder2->DefineField( "myPathName", array::typeid,FieldAttributes::Public );
- myFieldBuilder6->SetMarshal( UnmanagedMarshal::DefineByValArray( 128 ) );
- myFieldBuilder6->SetOffset( 4 );
- Type^ myType1 = myTypeBuilder2->CreateType();
-
- // Create the PInvoke method for 'OpenFile' method of 'Kernel32.dll'.
- array^myParameters = {String::typeid,myType1,UInt32::typeid};
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefinePInvokeMethod( "OpenFile", "kernel32.dll", static_cast(MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::HideBySig), CallingConventions::Standard, IntPtr::typeid, myParameters, CallingConvention::Winapi, CharSet::None );
- Type^ myAttributeType = MethodImplAttribute::typeid;
- array^type1 = {MethodImplOptions::typeid};
- ConstructorInfo^ myConstructorInfo = myAttributeType->GetConstructor( type1 );
- array^obj1 = {MethodImplOptions::PreserveSig};
- CustomAttributeBuilder^ myAttributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 );
- myMethodBuilder->SetCustomAttribute( myAttributeBuilder );
- ParameterBuilder^ myParameterBuilder2 = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "myClass2" );
- Type^ myType = myTypeBuilder->CreateType();
- myAssembly->Save( "EmittedAssembly.dll" );
- return myType;
-}
-
-int main()
-{
- try
- {
- Type^ myType = CreateType( Thread::GetDomain() );
- Type^ myClass2 = myType->Module->GetType( "MyClass2" );
- Object^ myParam2 = Activator::CreateInstance( myClass2 );
- UInt32 myUint = 0x00000800;
- array^myArgs = {"MyFile.Txt",myParam2,myUint};
- Object^ myObject = myType->InvokeMember( "OpenFile", static_cast(BindingFlags::Public | BindingFlags::InvokeMethod | BindingFlags::Static), nullptr, nullptr, myArgs );
- Console::WriteLine( "MyClass::OpenFile method returned: \"{0}\"", myObject );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception Caught {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp
deleted file mode 100644
index 58a29d2bc11..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class FieldInfoClass
-{
-public:
- int myField1;
-
-protected:
- String^ myField2;
-};
-
-int main()
-{
- array^myFieldInfo;
- Type^ myType = FieldInfoClass::typeid;
-
- // Get the type and fields of FieldInfoClass.
- myFieldInfo = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Public) );
- Console::WriteLine( "\nThe fields of FieldInfoClass are \n" );
-
- // Display the field information of FieldInfoClass.
- for ( int i = 0; i < myFieldInfo->Length; i++ )
- {
- Console::WriteLine( "\nName : {0}", myFieldInfo[ i ]->Name );
- Console::WriteLine( "Declaring Type : {0}", myFieldInfo[ i ]->DeclaringType );
- Console::WriteLine( "IsPublic : {0}", myFieldInfo[ i ]->IsPublic );
- Console::WriteLine( "MemberType : {0}", myFieldInfo[ i ]->MemberType );
- Console::WriteLine( "FieldType : {0}", myFieldInfo[ i ]->FieldType );
- Console::WriteLine( "IsFamily : {0}", myFieldInfo[ i ]->IsFamily );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp
deleted file mode 100644
index 8d70ea8d553..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyClass
-{
-public:
- String^ MyField;
-};
-
-void DisplayFieldHandle( RuntimeFieldHandle myFieldHandle )
-{
- // Get the type from the handle.
- FieldInfo^ myField = FieldInfo::GetFieldFromHandle( myFieldHandle );
-
- // Display the type.
- Console::WriteLine( "\nDisplaying the field from the handle.\n" );
- Console::WriteLine( "The type is {0}.", myField );
-}
-
-int main()
-{
- MyClass^ myClass = gcnew MyClass;
-
- // Get the type of MyClass.
- Type^ myType = MyClass::typeid;
- try
- {
- // Get the field information of MyField.
- FieldInfo^ myFieldInfo = myType->GetField( "MyField", static_cast(BindingFlags::Public | BindingFlags::Instance) );
-
- // Determine whether or not the FieldInfo Object* is 0.
- if ( myFieldInfo != nullptr )
- {
- // Get the handle for the field.
- RuntimeFieldHandle myFieldHandle = myFieldInfo->FieldHandle;
- DisplayFieldHandle( myFieldHandle );
- }
- else
- {
- Console::WriteLine( "The myFieldInfo Object* is 0." );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp
deleted file mode 100644
index 558c1eaa9ca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class FieldInfo_GetFieldFromHandle
-{
-public:
- String^ x;
- Char y;
- float a;
- int b;
-};
-
-int main()
-{
- // Get the type of the FieldInfo_GetFieldFromHandle class.
- Type^ myType = FieldInfo_GetFieldFromHandle::typeid;
-
- // Get the fields of the FieldInfo_GetFieldFromHandle class.
- array^myFieldInfoArray = myType->GetFields();
- Console::WriteLine( "\nThe field information of the declared fields x, y, a, and b is:\n" );
- RuntimeFieldHandle myRuntimeFieldHandle;
- for ( int i = 0; i < myFieldInfoArray->Length; i++ )
- {
- // Get the RuntimeFieldHandle of myFieldInfoArray.
- myRuntimeFieldHandle = myFieldInfoArray[ i ]->FieldHandle;
-
- // Call the GetFieldFromHandle method.
- FieldInfo^ myFieldInfo = FieldInfo::GetFieldFromHandle( myRuntimeFieldHandle );
-
- // Display the FieldInfo of myFieldInfo.
- Console::WriteLine( " {0}", myFieldInfo );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp
deleted file mode 100644
index b4d9d357a06..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class FieldsClass
-{
- public:
- String^ fieldA;
- String^ fieldB;
-
- FieldsClass()
- {
- fieldA = "A public field";
- fieldB = "Another public field";
- }
-};
-
-int main()
-{
- FieldsClass^ fieldsInst = gcnew FieldsClass;
-
- // Get the type of FieldsClass.
- Type^ fieldsType = FieldsClass::typeid;
-
- // Get the FieldInfo of FieldsClass.
- array^ fields = fieldsType->GetFields(static_cast(BindingFlags::Public | BindingFlags::Instance));
-
- // Display the values of the fields.
- Console::WriteLine("Displaying the values of the fields of {0}:", fieldsType);
- for (int i = 0; i < fields->Length; i++)
- {
- Console::WriteLine(" {0}:\t'{1}'",
- fields[i]->Name, fields[i]->GetValue(fieldsInst));
- }
-}
-// The example displays the following output:
-// Displaying the values of the fields of FieldsClass:
-// fieldA: 'A public field'
-// fieldB: 'Another public field'
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp
deleted file mode 100644
index 49b86026b86..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::Serialization;
-
-public ref class MyClass
-{
-public:
- short myShort;
-
- // The following field will not be serialized.
-
- [NonSerialized]
- int myInt;
-};
-
-int main()
-{
- // Get the type of MyClass.
- Type^ myType = MyClass::typeid;
-
- // Get the fields of MyClass.
- array^myFields = myType->GetFields( static_cast(BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Static) );
- Console::WriteLine( "\nDisplaying whether or not the field is serializable.\n" );
-
- // Display whether or not the field is serializable.
- for ( int i = 0; i < myFields->Length; i++ )
- if ( myFields[ i ]->IsNotSerialized )
- Console::WriteLine( "The {0} field is not serializable.", myFields[ i ] );
- else
- Console::WriteLine( "The {0} field is serializable.", myFields[ i ] );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp
deleted file mode 100644
index 5d8ebfb8a80..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Fieldinfo_IsPinvoke
-{
-public:
- String^ myField;
- Fieldinfo_IsPinvoke()
- {
- myField = "A public field";
- }
-};
-
-int main()
-{
- Fieldinfo_IsPinvoke^ myObject = gcnew Fieldinfo_IsPinvoke;
-
- // Get the Type and FieldInfo.
- Type^ myType1 = Fieldinfo_IsPinvoke::typeid;
- FieldInfo^ myFieldInfo = myType1->GetField( "myField", static_cast(BindingFlags::Public | BindingFlags::Instance) );
-
- // Display the name, field and the PInvokeImpl attribute for the field.
- Console::Write( "\n Name of class: {0}", myType1->FullName );
- Console::Write( "\n Value of field: {0}", myFieldInfo->GetValue( myObject ) );
- Console::Write( "\n IsPinvokeImpl: {0}", myFieldInfo->IsPinvokeImpl );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp
deleted file mode 100644
index 19e2ca9f358..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-ref class MyClass
-{
-private:
- String^ myField;
-
-public:
- array^myArray;
- MyClass()
- {
- myField = "Microsoft";
- array^s = {"New York","New Jersey"};
- myArray = s;
- }
-
- property String^ GetField
- {
- String^ get()
- {
- return myField;
- }
- }
-};
-
-int main()
-{
- try
- {
- // Gets the type of MyClass.
- Type^ myType = MyClass::typeid;
-
- // Gets the field information of MyClass.
- array^myFields = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Public | BindingFlags::Instance) );
- Console::WriteLine( "\nDisplaying whether the fields of {0} are private or not:\n", myType );
- for ( int i = 0; i < myFields->Length; i++ )
- {
- // Check whether the field is private or not.
- if ( myFields[ i ]->IsPrivate )
- Console::WriteLine( " {0} is a private field.", myFields[ i ]->Name );
- else
- Console::WriteLine( " {0} is not a private field.", myFields[ i ]->Name );
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0} ", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp
deleted file mode 100644
index 0e31a95a459..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::ComponentModel::Design;
-
-int main()
-{
- try
- {
- // Get the type handle of a specified class.
- Type^ myType = ViewTechnology::typeid;
-
- // Get the fields of the specified class.
- array^myField = myType->GetFields();
- Console::WriteLine( "\nDisplaying fields that have SpecialName attributes:\n" );
- for ( int i = 0; i < myField->Length; i++ )
- {
- // Determine whether or not each field is a special name.
- if ( myField[ i ]->IsSpecialName )
- {
- Console::WriteLine( "The field {0} has a SpecialName attribute.", myField[ i ]->Name );
- }
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception : {0} ", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp
deleted file mode 100644
index 5ba37dacd8a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Globalization;
-
-public ref class Example
-{
-private:
- String^ myString;
-
-public:
- Example()
- {
- myString = "Old value";
- }
-
- property String^ StringProperty
- {
- String^ get()
- {
- return myString;
- }
- }
-};
-
-int main()
-{
- Example^ myObject = gcnew Example;
- Type^ myType = Example::typeid;
- FieldInfo^ myFieldInfo = myType->GetField( "myString",
- BindingFlags::NonPublic | BindingFlags::Instance);
-
- // Display the string before applying SetValue to the field.
- Console::WriteLine( "\nThe field value of myString is \"{0}\".",
- myFieldInfo->GetValue( myObject ) );
- // Display the SetValue signature used to set the value of a field.
- Console::WriteLine( "Applying SetValue(Object, Object)." );
-
- // Change the field value using the SetValue method.
- myFieldInfo->SetValue( myObject, "New value" );
- // Display the string after applying SetValue to the field.
- Console::WriteLine( "The field value of mystring is \"{0}\".",
- myFieldInfo->GetValue(myObject));
-}
-/* This code produces the following output:
-
-The field value of myString is "Old value".
-Applying SetValue(Object, Object).
-The field value of mystring is "New value".
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp
deleted file mode 100644
index 9f909725077..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class GenericReflectionSample
-{
-};
-
-int main()
-{
- // Creating a dynamic assembly requires an AssemblyName
- // object, and the current application domain.
- //
- AssemblyName^ asmName =
- gcnew AssemblyName("EmittedAssembly");
- AppDomain^ domain = AppDomain::CurrentDomain;
- AssemblyBuilder^ sampleAssemblyBuilder =
- domain->DefineDynamicAssembly(asmName,
- AssemblyBuilderAccess::RunAndSave);
-
- // Define the module that contains the code. For an
- // assembly with one module, the module name is the
- // assembly name plus a file extension.
- ModuleBuilder^ sampleModuleBuilder =
- sampleAssemblyBuilder->DefineDynamicModule(asmName->Name,
- asmName->Name + ".dll");
-
- TypeBuilder^ sampleTypeBuilder =
- sampleModuleBuilder->DefineType("SampleType",
- TypeAttributes::Public | TypeAttributes::Abstract);
-
- //
- // Define a Shared, Public method with standard calling
- // conventions. Do not specify the parameter types or the
- // return type, because type parameters will be used for
- // those types, and the type parameters have not been
- // defined yet.
- MethodBuilder^ sampleMethodBuilder =
- sampleTypeBuilder->DefineMethod("SampleMethod",
- MethodAttributes::Public | MethodAttributes::Static);
- //
-
- //
- // Defining generic parameters for the method makes it a
- // generic method. By convention, type parameters are
- // single alphabetic characters. T and U are used here.
- //
- array^ genericTypeNames = {"T", "U"};
- array^ genericTypes =
- sampleMethodBuilder->DefineGenericParameters(
- genericTypeNames);
- //
-
- //
- // Use the IsGenericMethod property to find out if a
- // dynamic method is generic, and IsGenericMethodDefinition
- // to find out if it defines a generic method.
- Console::WriteLine("Is SampleMethod generic? {0}",
- sampleMethodBuilder->IsGenericMethod);
- Console::WriteLine(
- "Is SampleMethod a generic method definition? {0}",
- sampleMethodBuilder->IsGenericMethodDefinition);
- //
-
- //
- // Set parameter types for the method. The method takes
- // one parameter, and its type is specified by the first
- // type parameter, T.
- array^ parameterTypes = {genericTypes[0]};
- sampleMethodBuilder->SetParameters(parameterTypes);
-
- // Set the return type for the method. The return type is
- // specified by the second type parameter, U.
- sampleMethodBuilder->SetReturnType(genericTypes[1]);
- //
-
- // Generate a code body for the method. The method doesn't
- // do anything except return null.
- //
- ILGenerator^ ilgen = sampleMethodBuilder->GetILGenerator();
- ilgen->Emit(OpCodes::Ldnull);
- ilgen->Emit(OpCodes::Ret);
-
- //
- // Complete the type.
- Type^ sampleType = sampleTypeBuilder->CreateType();
-
- // To bind types to a dynamic generic method, you must
- // first call the GetMethod method on the completed type.
- // You can then define an array of types, and bind them
- // to the method.
- MethodInfo^ sampleMethodInfo = sampleType->GetMethod("SampleMethod");
- array^ boundParameters =
- {String::typeid, GenericReflectionSample::typeid};
- MethodInfo^ boundMethodInfo =
- sampleMethodInfo->MakeGenericMethod(boundParameters);
- // Display a string representing the bound method.
- Console::WriteLine(boundMethodInfo);
- //
-
- // Save the assembly, so it can be examined with Ildasm.exe.
- sampleAssemblyBuilder->Save(asmName->Name + ".dll");
-}
-
-/* This code example produces the following output:
-Is SampleMethod generic? True
-Is SampleMethod a generic method definition? True
-GenericReflectionSample SampleMethod[String,GenericReflectionSample](System.String)
-*/
-//
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp b/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp
deleted file mode 100644
index 4fd14cbab59..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-ref class Example
-{
- public:
- static String^ val = "test";
-};
-
-int main()
-{
- FieldInfo^ fld = Example::typeid->GetField( "val" );
- Console::WriteLine(fld->GetValue(nullptr) );
- Example::val = "hi";
- Console::WriteLine(fld->GetValue(nullptr) );
-}
-// The example displays the following output:
-// test
-// hi
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp
deleted file mode 100644
index 59545a35ced..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-
-// System.Reflection.Emit.ILGenerator.BeginFaultBlock()
-/*
-The following program demonstrates the 'BeginFaultBlock()' method of 'ILGenerator'
-class. Exception is raised by passing two integer values which are out of range,
-the same is caught in the 'BeginExceptionBlock' which is non-filtered. First it
-checks for the exception thrown in the 'BeginFaultBlock' and then emits the MSIL
-instructions in 'BeginExceptFilterBlock'.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-Type^ AddType()
-{
- // Create an assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "AdderExceptionAsm";
-
- // Create dynamic assembly.
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" );
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" );
- array^myAdderParams = {int::typeid,int::typeid};
-
- // Method to add two numbers.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, myAdderParams );
- ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator();
-
- // Create constructor.
- array^temp0 = {String::typeid};
- ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( temp0 );
- MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" );
- array^temp1 = {String::typeid,Object::typeid};
- MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", temp1 );
-
- // Declare local variable.
- LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid );
- LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid );
-
- // Define label.
- Label myFailedLabel = myAdderIL->DefineLabel();
- Label myEndOfMethodLabel = myAdderIL->DefineLabel();
-
- // Begin exception block.
- Label myLabel = myAdderIL->BeginExceptionBlock();
- myAdderIL->Emit( OpCodes::Ldarg_0 );
- myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 );
- myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldarg_1 );
- myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 );
- myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldarg_0 );
- myAdderIL->Emit( OpCodes::Ldarg_1 );
- myAdderIL->Emit( OpCodes::Add_Ovf_Un );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 );
- myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel );
- myAdderIL->MarkLabel( myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for addition." );
- myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 );
-
- // Call fault block.
- myAdderIL->BeginFaultBlock();
- Console::WriteLine( "Fault block called." );
-
- //Throw exception.
- myAdderIL->ThrowException( NotSupportedException::typeid );
-
- // Call finally block.
- myAdderIL->BeginFinallyBlock();
- myAdderIL->Emit( OpCodes::Ldstr, "{0}" );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 );
- myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr );
- myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr );
- myAdderIL->Emit( OpCodes::Ldc_I4_M1 );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 );
-
- // End exception block.
- myAdderIL->EndExceptionBlock();
- myAdderIL->MarkLabel( myEndOfMethodLabel );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 );
- myAdderIL->Emit( OpCodes::Ret );
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- Type^ myAddType = AddType();
- Object^ myObject1 = Activator::CreateInstance( myAddType );
- array^myObject2 = {11,12};
-
- // Invoke member.
- myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp
deleted file mode 100644
index bc0c0c8e893..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-
-// System::Reflection::Emit::ILGenerator.BeginExceptFilterBlock()
-// System::Reflection::Emit::ILGenerator.BeginFinallyBlock()
-/*
- The following program demonstrates the 'BeginExceptFilterBlock()' method and
- 'BeginFinallyBlock()' of 'ILGenerator' class. Exception is raised by passing
- two integer values which are out of range, the same is caught in the
- 'BeginExceptionBlock' which is non-filtered and then emits the MSIL
- instructions in 'BeginExceptFilterBlock' and 'BeginFinallyBlock'.
-*/
-//
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class ILGenerator_BeginFinallyBlock
-{
-public:
- static Type^ AddType()
- {
- // Create an assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "AdderExceptionAsm";
-
- // Create dynamic assembly.
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" );
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" );
- array^adderParams = {int::typeid,int::typeid};
-
- // Define method to add two numbers.
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams );
- ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator();
-
- // Create constructor.
- array^type1 = {String::typeid};
- ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( type1 );
- MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" );
- array^type2 = {String::typeid,Object::typeid};
- MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", type2 );
-
- // Declare local variable.
- LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid );
- LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid );
-
- // Define label.
- Label myFailedLabel = myAdderIL->DefineLabel();
- Label myEndOfMethodLabel = myAdderIL->DefineLabel();
-
- // Begin exception block.
- Label myLabel = myAdderIL->BeginExceptionBlock();
- myAdderIL->Emit( OpCodes::Ldarg_0 );
- myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 );
- myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldarg_1 );
- myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 );
- myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldarg_0 );
- myAdderIL->Emit( OpCodes::Ldarg_1 );
- myAdderIL->Emit( OpCodes::Add_Ovf_Un );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 );
- myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel );
- myAdderIL->MarkLabel( myFailedLabel );
- myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for add." );
- myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 );
-
- // Throw the exception.
- myAdderIL->ThrowException( OverflowException::typeid );
-
- // Call 'BeginExceptFilterBlock'.
- myAdderIL->BeginExceptFilterBlock();
- myAdderIL->EmitWriteLine( "Except filter block called." );
-
- // Call catch block.
- myAdderIL->BeginCatchBlock( nullptr );
-
- // Call other catch block.
- myAdderIL->BeginCatchBlock( OverflowException::typeid );
- myAdderIL->Emit( OpCodes::Ldstr, "{0}" );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 );
- myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr );
- myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr );
- myAdderIL->Emit( OpCodes::Ldc_I4_M1 );
- myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 );
-
- // Call finally block.
- myAdderIL->BeginFinallyBlock();
- myAdderIL->EmitWriteLine( "Finally block called." );
-
- // End the exception block.
- myAdderIL->EndExceptionBlock();
- myAdderIL->MarkLabel( myEndOfMethodLabel );
- myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 );
- myAdderIL->Emit( OpCodes::Ret );
- return myTypeBuilder->CreateType();
- }
-};
-
-int main()
-{
- Type^ myAddType = ILGenerator_BeginFinallyBlock::AddType();
- Object^ myObject1 = Activator::CreateInstance( myAddType );
- array^myObject2 = {15,15};
- myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 );
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp
deleted file mode 100644
index 125264cb896..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-
-// System.Reflection.Emit.ILGenerator
-// System.Reflection.Emit.ILGenerator.BeginScope()
-// System.Reflection.Emit.ILGenerator.EndScope()
-/*
-This program demonstrates the 'BeginScope()', 'EndScope()' methods and the class
-'ILGenerator'. A dynamic class 'myTypeBuilder' is created in which a
-constructor 'myConstructor' and a method 'myMethod' are created dynamically. Their IL's
-are generated. A local variable 'myLocalBuilder' is declared using 'DeclareLocal' property
-of 'myMethodIL'. The scope of 'myLocalBuilder' is specified using 'BeginScope' and
-'EndScope' methods. Respective messages related to scope are printed on the console.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-int main()
-{
- try
- {
- //
- //
- // Get the current AppDomain.
- AppDomain^ myAppDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "SampleAssembly";
-
- // Create a dynamic assembly 'myAssembly' with access mode 'Run'.
- AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module 'myModule' in 'myAssembly'.
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "MyDynamicModule", true );
-
- // Define a public class 'MyDynamicClass'.
- TypeBuilder^ myTypeBuilder = myModule->DefineType( "MyDynamicClass", TypeAttributes::Public );
-
- // Define a public string field.
- FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public );
-
- // Create the constructor.
- array^myConstructorArgs = {String::typeid};
- ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs );
-
- // Generate IL for 'myConstructor'.
- ILGenerator^ myConstructorIL = myConstructor->GetILGenerator();
-
- // Emit the necessary opcodes.
- myConstructorIL->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ mySuperConstructor = Object::typeid->GetConstructor( gcnew array(0) );
- myConstructorIL->Emit( OpCodes::Call, mySuperConstructor );
- myConstructorIL->Emit( OpCodes::Ldarg_0 );
- myConstructorIL->Emit( OpCodes::Ldarg_1 );
- myConstructorIL->Emit( OpCodes::Stfld, myField );
- myConstructorIL->Emit( OpCodes::Ret );
-
- // Define a dynamic method named 'MyDynamicMethod'.
- MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Public, String::typeid, nullptr );
-
- // Generate IL for 'myMethod'.
- ILGenerator^ myMethodIL = myMethod->GetILGenerator();
-
- // Begin the scope for a local variable.
- myMethodIL->BeginScope();
- LocalBuilder^ myLocalBuilder = myMethodIL->DeclareLocal( int::typeid );
- Console::WriteLine( "\nTrying to access the local variable within the scope." );
- Console::WriteLine( "'myLocalBuilder' type is :{0}", myLocalBuilder->LocalType );
- myMethodIL->Emit( OpCodes::Ldstr, "Local value" );
- myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder );
-
- // End the scope of 'myLocalBuilder'.
- myMethodIL->EndScope();
-
- // Access the local variable outside the scope.
- Console::WriteLine( "\nTrying to access the local variable outside the scope:\n" );
- myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder );
- myMethodIL->Emit( OpCodes::Ldloc_0 );
- myMethodIL->Emit( OpCodes::Ret );
-
- // Create 'MyDynamicClass' class.
- Type^ myType1 = myTypeBuilder->CreateType();
- //
- //
-
- // Create an instance of the 'MyDynamicClass'.
- array^temp0 = {"HelloWorld"};
- Object^ myObject1 = Activator::CreateInstance( myType1, temp0 );
-
- // Invoke 'MyDynamicMethod' method of 'MyDynamicClass'.
- Object^ myObject2 = myType1->InvokeMember( "MyDynamicMethod", BindingFlags::InvokeMethod, nullptr, myObject1, nullptr );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception :{0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp
deleted file mode 100644
index 4c29bcd1705..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace System::ComponentModel;
-using namespace System::IO;
-using namespace System::Windows::Forms;
-public ref class Form1: public System::Windows::Forms::Form
-{
-private:
- System::Windows::Forms::TextBox^ textBox1;
-
- //
- String^ CreateMultilevelIndentString()
- {
-
- //
- // Creates a TextWriter to use as the base output writer.
- System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter;
-
- // Create an IndentedTextWriter and set the tab string to use
- // as the indentation string for each indentation level.
- System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter," " );
-
- //
- //
- // Sets the indentation level.
- indentWriter->Indent = 0;
-
- //
- // Output test strings at stepped indentations through a recursive loop method.
- WriteLevel( indentWriter, 0, 5 );
-
- // Return the resulting string from the base StringWriter.
- return baseTextWriter->ToString();
- }
-
-
- //
- void WriteLevel( IndentedTextWriter^ indentWriter, int level, int totalLevels )
- {
-
- // Output a test string with a new-line character at the end.
- indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
-
- // If not yet at the highest recursion level, call this output method for the next level of indentation.
- if ( level < totalLevels )
- {
-
- // Increase the indentation count for the next level of indented output.
- indentWriter->Indent++;
-
- // Call the WriteLevel method to write test output for the next level of indentation.
- WriteLevel( indentWriter, level + 1, totalLevels );
-
- // Restores the indentation count for this level after the recursive branch method has returned.
- indentWriter->Indent--;
- }
- else
- //
- // Outputs a string using the WriteLineNoTabs method.
- indentWriter->WriteLineNoTabs( "This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method." );
- //
- // Outputs a test string with a new-line character at the end.
- indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level );
- }
-
-
- //
- //
- void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
- {
- textBox1->Text = CreateMultilevelIndentString();
- }
-
-
-public:
- Form1()
- {
- System::Windows::Forms::Button^ button1 = gcnew System::Windows::Forms::Button;
- this->textBox1 = gcnew System::Windows::Forms::TextBox;
- this->SuspendLayout();
- this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
- this->textBox1->Location = System::Drawing::Point( 8, 40 );
- this->textBox1->Multiline = true;
- this->textBox1->Name = "textBox1";
- this->textBox1->Size = System::Drawing::Size( 391, 242 );
- this->textBox1->TabIndex = 0;
- this->textBox1->Text = "";
- button1->Location = System::Drawing::Point( 11, 8 );
- button1->Name = "button1";
- button1->Size = System::Drawing::Size( 229, 23 );
- button1->TabIndex = 1;
- button1->Text = "Generate string using IndentedTextWriter";
- button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
- this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 );
- this->ClientSize = System::Drawing::Size( 407, 287 );
- this->Controls->Add( button1 );
- this->Controls->Add( this->textBox1 );
- this->Name = "Form1";
- this->Text = "IndentedTextWriter example";
- this->ResumeLayout( false );
- }
-
-};
-
-
-[STAThread]
-int main()
-{
- Application::Run( gcnew Form1 );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp
deleted file mode 100644
index 75e16a96906..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-
-// System.Reflection.Emit.LocalBuilder
-// System.Reflection.Emit.ILGenerator.DeclareLocal(Type)
-// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String)
-// System.Reflection.Emit.LocalBuilder.LocalType()
-// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String, Int32, Int32)
-/*
-
-This program demonstrates 'LocalType' property, 'SetLocalSymInfo(String)',
-'SetLocalSymInfo(String, Int32,Int32)' methods, class level for 'LocalBuilder' and
-'DeclareLocal(Type)' method of ILGenerator class. An assembly 'myClass' is created using
-AssemblyBuilder, ModuleBuilder, FieldBuilder, TypeBuilder, ConstructorBuilder classes.
-Localbuilder class is used to create local variables of the specified type.
-
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Threading;
-int main()
-{
- // Create an assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "SampleAssembly";
- AssemblyBuilder^ myAssembly = Thread::GetDomain()->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a module. For a single-file assembly the module
- // name is usually the same as the assembly name.
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule(
- myAssemblyName->Name, myAssemblyName->Name + ".dll", true );
-
- // Define a public class 'Example'.
- TypeBuilder^ myTypeBuilder = myModule->DefineType( "Example", TypeAttributes::Public );
-
- // Create the 'Function1' public method, which takes an integer
- // and returns a string.
- MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "Function1",
- MethodAttributes::Public | MethodAttributes::Static, String::typeid,
- gcnew array { int::typeid } );
-
- // Generate IL for 'Function1'. The function body demonstrates
- // assigning an argument to a local variable, assigning a
- // constant string to a local variable, and putting the contents
- // of local variables on the stack.
- ILGenerator^ myMethodIL = myMethod->GetILGenerator();
-
- //
- // Create local variables named myString and myInt.
- LocalBuilder^ myLB1 = myMethodIL->DeclareLocal( String::typeid );
- myLB1->SetLocalSymInfo( "myString" );
- Console::WriteLine( "local 'myString' type is: {0}", myLB1->LocalType );
-
- LocalBuilder^ myLB2 = myMethodIL->DeclareLocal( int::typeid );
- myLB2->SetLocalSymInfo( "myInt", 1, 2 );
- Console::WriteLine( "local 'myInt' type is: {0}", myLB2->LocalType );
- //
-
- // Store the function argument in myInt.
- myMethodIL->Emit( OpCodes::Ldarg_0 );
- myMethodIL->Emit( OpCodes::Stloc_1 );
-
- // Store a literal value in myString, and return the value.
- myMethodIL->Emit( OpCodes::Ldstr, "string value" );
- myMethodIL->Emit( OpCodes::Stloc_0 );
- myMethodIL->Emit( OpCodes::Ldloc_0 );
- myMethodIL->Emit( OpCodes::Ret );
-
- // Create "Example" class.
- Type^ myType1 = myTypeBuilder->CreateType();
- Console::WriteLine( "'Example' is created." );
-
- myAssembly->Save(myAssemblyName->Name + ".dll");
- Console::WriteLine( "'{0}' is created.", myAssemblyName->Name + ".dll" );
-
- // Invoke 'Function1' method of 'Example', passing the value 42.
- Object^ myObject2 = myType1->InvokeMember( "Function1",
- BindingFlags::InvokeMethod, nullptr, nullptr,
- gcnew array { 42 } );
-
- Console::WriteLine( "Example::Function1 returned: {0}", myObject2 );
-}
-/* This code example produces the following output:
-
-local 'myString' type is: System.String
-local 'myInt' type is: System.Int32
-'Example' is created.
-'SampleAssembly.dll' is created.
-Example::Function1 returned: string value
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp
deleted file mode 100644
index e978a2ab18b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-int main()
-{
- // Define a dynamic assembly to contain the sample type. The
- // assembly will not be run, but only saved to disk, so
- // AssemblyBuilderAccess.Save is specified.
- //
- AppDomain^ appDomain = AppDomain::CurrentDomain;
- AssemblyName^ assemblyName = gcnew
- AssemblyName("MakeXxxGenericTypeParameterExample");
- AssemblyBuilder^ assemblyBuilder = appDomain->DefineDynamicAssembly
- (assemblyName, AssemblyBuilderAccess::Save);
-
- // An assembly is made up of executable modules. For a single
- // module assembly, the module name and file name are the
- // same as the assembly name.
- ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule
- (assemblyName->Name, assemblyName->Name + ".dll");
-
- // Define the sample type.
- TypeBuilder^ typeBuilder = moduleBuilder->DefineType("Sample",
- TypeAttributes::Public | TypeAttributes::Abstract);
-
- // Make the sample type a generic type, by defining a type
- // parameter T. All type parameters are defined at the same
- // time, by passing an array containing the type parameter
- // names.
- array^ typeParamNames = {"T"};
- array^ typeParams =
- typeBuilder->DefineGenericParameters(typeParamNames);
-
- // Define a method that takes a ByRef argument of type T, a
- // pointer to type T, and one-dimensional array of type T.
- // The method returns a two-dimensional array of type T.
- //
- // To create this method, you need Type objects that repre-
- // sent the parameter types and the return type. Use the
- // MakeByRefType, MakePointerType, and MakeArrayType methods
- // to create the Type objects, using the generic type para-
- // meter T.
- //
- Type^ byRefType = typeParams[0]->MakeByRefType();
- Type^ pointerType = typeParams[0]->MakePointerType();
- Type^ arrayType = typeParams[0]->MakeArrayType();
- Type^ twoDimArrayType = typeParams[0]->MakeArrayType(2);
-
- // Create the array of parameter types.
- array^ parameterTypes = {byRefType, pointerType, arrayType};
-
- // Define the abstract Test method. After you have compiled
- // and run this example code, you can use ildasm.exe to open
- // MakeXxxGenericTypeParameterExample.dll, examine the Sample
- // type, and verify the parameter types and return type of
- // the TestMethod method.
- //
- MethodBuilder^ methodBuilder = typeBuilder->DefineMethod("TestMethod",
- MethodAttributes::Abstract | MethodAttributes::Virtual
- | MethodAttributes::Public, twoDimArrayType, parameterTypes);
-
- // Create the type and save the assembly. For a single-file
- // assembly, there is only one module to store the manifest
- // information in.
- //
- typeBuilder->CreateType();
- assemblyBuilder->Save(assemblyName->Name + ".dll");
-};
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp
deleted file mode 100644
index 3586a67f36a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a custom attribute with one named parameter.
-
-[AttributeUsage(AttributeTargets::All)]
-public ref class MyAttribute: public Attribute
-{
-private:
- String^ myName;
-
-public:
- MyAttribute( String^ name )
- {
- myName = name;
- }
-
- property String^ Name
- {
- String^ get()
- {
- return myName;
- }
- }
-};
-
-// Define a class that has the custom attribute associated with one of its members.
-public ref class MyClass1
-{
-public:
-
- [MyAttribute("This is an example attribute.")]
- void MyMethod( int i ){}
-};
-
-int main()
-{
- try
- {
- // Get the type of MyClass1.
- Type^ myType = MyClass1::typeid;
-
- // Get the members associated with MyClass1.
- array^myMembers = myType->GetMembers();
-
- // Display the attributes for each of the members of MyClass1.
- for ( int i = 0; i < myMembers->Length; i++ )
- {
- // Display the attribute if it is of type MyAttribute.
- if ( myMembers[ i ]->IsDefined( MyAttribute::typeid, false ) )
- {
- array^myAttributes = myMembers[ i ]->GetCustomAttributes( MyAttribute::typeid, false );
- Console::WriteLine( "\nThe attributes of type MyAttribute for the member {0} are: \n", myMembers[ i ] );
- for ( int j = 0; j < myAttributes->Length; j++ )
-
- // Display the value associated with the attribute.
- Console::WriteLine( "The value of the attribute is : \"{0}\"",
- (safe_cast(myAttributes[ j ]))->Name );
- }
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp
deleted file mode 100644
index 6153b2ffb03..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a custom attribute with one named parameter.
-
-[AttributeUsage(AttributeTargets::All)]
-public ref class MyAttribute: public Attribute
-{
-private:
- String^ myName;
-
-public:
- MyAttribute( String^ name )
- {
- myName = name;
- }
-
- property String^ Name
- {
- String^ get()
- {
- return myName;
- }
- }
-};
-
-// Define a class that has the custom attribute associated with one of its members.
-public ref class MyClass1
-{
-public:
-
- [MyAttribute("This is an example attribute.")]
- void MyMethod( int i )
- {
- return;
- }
-};
-
-int main()
-{
- try
- {
- // Get the type of MyClass1.
- Type^ myType = MyClass1::typeid;
-
- // Get the members associated with MyClass1.
- array^myMembers = myType->GetMembers();
-
- // Display the attributes for each of the members of MyClass1.
- for ( int i = 0; i < myMembers->Length; i++ )
- {
- array^myAttributes = myMembers[ i ]->GetCustomAttributes( true );
- if ( myAttributes->Length > 0 )
- {
- Console::WriteLine( "\nThe attributes for the member {0} are: \n", myMembers[ i ] );
- for ( int j = 0; j < myAttributes->Length; j++ )
- Console::WriteLine( "The type of the attribute is {0}.", myAttributes[ j ] );
- }
- }
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "An exception occurred: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp
deleted file mode 100644
index 44d2576e6eb..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// 1 - (entire sample) MethodBody class
-// 2 - (everything through GetMethodBody and displaying InitLocals & MaxStackSize)
-// 3 - (displaying locals)
-// 4 - (displaying exception clauses)
-// 5 - (end of Main, example method, beginning of output through output for snippet 2)
-// 6 - (output for snippet 3 (locals))
-// 7 - (output for snippet 4 (clauses))
-// 2,5 - InitLocals, MaxStackSize
-// 2,3,5,6 - lvis property, lviInfo class
-// 2,4,5,7 - ExceptionHandlingClauses property, ExceptionHandlingClause class, ExceptionHandlingClauseFlags enum
-//
-//
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Example
-{
- //
- // The Main method contains code to analyze this method, using
- // the properties and methods of the MethodBody class.
-public:
- void MethodBodyExample(Object^ arg)
- {
- // Define some local variables. In addition to these variables,
- // the local variable list includes the variables scoped to
- // the catch clauses.
- int var1 = 42;
- String^ var2 = "Forty-two";
-
- try
- {
- // Depending on the input value, throw an ArgumentException or
- // an ArgumentNullException to test the Catch clauses.
- if (arg == nullptr)
- {
- throw gcnew ArgumentNullException("The argument cannot " +
- "be null.");
- }
- if (arg->GetType() == String::typeid)
- {
- throw gcnew ArgumentException("The argument cannot " +
- "be a string.");
- }
- }
-
- // There is no Filter clause in this code example. See the Visual
- // Basic code for an example of a Filter clause.
-
- // This catch clause handles the ArgumentException class, and
- // any other class derived from Exception.
- catch (ArgumentException^ ex)
- {
- Console::WriteLine("Ordinary exception-handling clause caught:" +
- " {0}", ex->GetType());
- }
- finally
- {
- var1 = 3033;
- var2 = "Another string.";
- }
- }
- //
-};
-
-int main()
-{
- // Get method body information.
- MethodInfo^ mi =
- Example::typeid->GetMethod("MethodBodyExample");
-
- MethodBody^ mb = mi->GetMethodBody();
- Console::WriteLine("\r\nMethod: {0}", mi);
-
- // Display the general information included in the
- // MethodBody object.
- Console::WriteLine(" Local variables are initialized: {0}",
- mb->InitLocals);
- Console::WriteLine(" Maximum number of items on the operand " +
- "stack: {0}", mb->MaxStackSize);
- //
- //
-
- // Display information about the local variables in the
- // method body.
- Console::WriteLine();
- for each (LocalVariableInfo^ lvi in mb->LocalVariables)
- {
- Console::WriteLine("Local variable: {0}", lvi);
- }
- //
- //
-
- // Display exception handling clauses.
- Console::WriteLine();
- for each(ExceptionHandlingClause^ exhc in mb->ExceptionHandlingClauses)
- {
- Console::WriteLine(exhc->Flags.ToString());
-
- // The FilterOffset property is meaningful only for Filter
- // clauses. The CatchType property is not meaningful for
- // Filter or Finally clauses.
- switch(exhc->Flags)
- {
- case ExceptionHandlingClauseOptions::Filter:
- Console::WriteLine(" Filter Offset: {0}",
- exhc->FilterOffset);
- break;
- case ExceptionHandlingClauseOptions::Finally:
- break;
- default:
- Console::WriteLine(" Type of exception: {0}",
- exhc->CatchType);
- break;
- }
-
- Console::WriteLine(" Handler Length: {0}",
- exhc->HandlerLength);
- Console::WriteLine(" Handler Offset: {0}",
- exhc->HandlerOffset);
- Console::WriteLine(" Try Block Length: {0}", exhc->TryLength);
- Console::WriteLine(" Try Block Offset: {0}", exhc->TryOffset);
- }
- //
-}
-
-//This code example produces output similar to the following:
-//
-//Method: Void MethodBodyExample(System.Object)
-// Local variables are initialized: False
-// Maximum number of items on the operand stack: 4
-//
-//
-//Local variable: System.ArgumentException (0)
-//Local variable: System.String (1)
-//Local variable: System.Int32 (2)
-//
-//
-//Clause
-// Type of exception: System.ArgumentException
-// Handler Length: 29
-// Handler Offset: 78
-// Try Block Length: 65
-// Try Block Offset: 13
-//Finally
-// Handler Length: 13
-// Handler Offset: 113
-// Try Block Length: 100
-// Try Block Offset: 13
-//
-//
-
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp
deleted file mode 100644
index 546d0961119..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-void main()
-{
- // Define a transient dynamic assembly (only to run, not
- // to save) with one module and a type "Test".
- //
- AssemblyName^ aName = gcnew AssemblyName("MyDynamic");
- AssemblyBuilder^ ab =
- AppDomain::CurrentDomain->DefineDynamicAssembly(
- aName,
- AssemblyBuilderAccess::Run);
- ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name);
- TypeBuilder^ tb = mb->DefineType("Test");
-
- // Add a public static method "M" to Test, and make it a
- // generic method with one type parameter named "T").
- //
- MethodBuilder^ meb = tb->DefineMethod("M",
- MethodAttributes::Public | MethodAttributes::Static);
- array^ typeParams =
- meb->DefineGenericParameters(gcnew array { "T" });
-
- // Give the method one parameter, of type T, and a
- // return type of T.
- meb->SetParameters(typeParams);
- meb->SetReturnType(typeParams[0]);
-
- // Create a MethodInfo for M, which can be used in
- // emitted code. This is possible even though the method
- // does not yet have a body, and the enclosing type is not
- // created.
- MethodInfo^ mi = meb->MakeGenericMethod(String::typeid);
- // Note that this is actually a subclass of MethodInfo,
- // which has rather limited capabilities -- for
- // example, you cannot reflect on its parameters.
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp
deleted file mode 100644
index f43a09ff0c7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-// System.Reflection.Emit.MethodBuilder
-/*
-This program demonstrates 'MethodBuilder' class. A dynamic class 'myTypeBuilder'
-is created in which a constructor 'myConstructorBuilder' and a method 'myMethodBuilder'
-are created dynamically. Their IL's are generated. The Non-Public methods of the class
-are printed on the console. The attributes and signature of 'MyDynamicMethod' are displayed
-on the console using 'Attributes' and 'Signature' properties of the 'MethodBuilder' class.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-int main()
-{
- try
- {
- // Get the current AppDomain.
- AppDomain^ myAppDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "MyDynamicAssembly";
-
- // Create the dynamic assembly and set its access mode to 'Save'.
- AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save );
-
- // Create a dynamic module 'myModuleBuilder'.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyDynamicModule", true );
-
- // Define a public class 'MyDynamicClass'.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public );
-
- // Define a public string field named 'myField'.
- FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public );
-
- // Define the dynamic method 'MyDynamicMethod'.
- array^temp0 = gcnew array(0);
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Private, int::typeid, temp0 );
-
- // Generate the IL for 'myMethodBuilder'.
- ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator();
-
- // Emit the necessary opcodes.
- myMethodIL->Emit( OpCodes::Ldarg_0 );
- myMethodIL->Emit( OpCodes::Ldfld, myField );
- myMethodIL->Emit( OpCodes::Ret );
-
- // Create 'myTypeBuilder' class.
- Type^ myType1 = myTypeBuilder->CreateType();
-
- // Get the method information of 'myTypeBuilder'.
- array^myInfo = myType1->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
-
- // Print non-public methods present of 'myType1'.
- Console::WriteLine( "\nThe Non-Public methods present in 'myType1' are:\n" );
- for ( int i = 0; i < myInfo->Length; i++ )
- {
- Console::WriteLine( myInfo[ i ]->Name );
- }
- Console::WriteLine( "\nThe Attribute of 'MyDynamicMethod' is :{0}", myMethodBuilder->Attributes );
- Console::WriteLine( "\nThe Signature of 'MyDynamicMethod' is : \n{0}", myMethodBuilder->Signature );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception :{0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp
deleted file mode 100644
index f2e621d6748..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-//
-// Define a class with a generic method.
-ref class Example
-{
-public:
- generic static void Generic(T toDisplay)
- {
- Console::WriteLine("\r\nHere it is: {0}", toDisplay);
- }
-};
-//
-
-void DisplayGenericMethodInfo(MethodInfo^ mi)
-{
- Console::WriteLine("\r\n{0}", mi);
-
- //
- Console::WriteLine("\tIs this a generic method definition? {0}",
- mi->IsGenericMethodDefinition);
- //
-
- //
- Console::WriteLine("\tIs it a generic method? {0}",
- mi->IsGenericMethod);
- //
-
- //
- Console::WriteLine("\tDoes it have unassigned generic parameters? {0}",
- mi->ContainsGenericParameters);
- //
-
- //
- // If this is a generic method, display its type arguments.
- //
- if (mi->IsGenericMethod)
- {
- array^ typeArguments = mi->GetGenericArguments();
-
- Console::WriteLine("\tList type arguments ({0}):",
- typeArguments->Length);
-
- for each (Type^ tParam in typeArguments)
- {
- // IsGenericParameter is true only for generic type
- // parameters.
- //
- if (tParam->IsGenericParameter)
- {
- Console::WriteLine("\t\t{0} parameter position {1}" +
- "\n\t\t declaring method: {2}",
- tParam,
- tParam->GenericParameterPosition,
- tParam->DeclaringMethod);
- }
- else
- {
- Console::WriteLine("\t\t{0}", tParam);
- }
- }
- }
- //
-};
-
-void main()
-{
- Console::WriteLine("\r\n--- Examine a generic method.");
-
- //
- // Create a Type object representing class Example, and
- // get a MethodInfo representing the generic method.
- //
- Type^ ex = Example::typeid;
- MethodInfo^ mi = ex->GetMethod("Generic");
-
- DisplayGenericMethodInfo(mi);
-
- // Assign the int type to the type parameter of the Example
- // method.
- //
- MethodInfo^ miConstructed = mi->MakeGenericMethod(int::typeid);
-
- DisplayGenericMethodInfo(miConstructed);
- //
-
- // Invoke the method.
- array^ args = { 42 };
- miConstructed->Invoke((Object^) 0, args);
-
- // Invoke the method normally.
- Example::Generic(42);
-
- //
- // Get the generic type definition from the closed method,
- // and show it's the same as the original definition.
- //
- MethodInfo^ miDef = miConstructed->GetGenericMethodDefinition();
- Console::WriteLine("\r\nThe definition is the same: {0}",
- miDef == mi);
- //
-};
-
-/* This example produces the following output:
-
---- Examine a generic method.
-
-Void Generic[T](T)
- Is this a generic method definition? True
- Is it a generic method? True
- Does it have unassigned generic parameters? True
- List type arguments (1):
- T parameter position 0
- declaring method: Void Generic[T](T)
-
-Void Generic[Int32](Int32)
- Is this a generic method definition? False
- Is it a generic method? True
- Does it have unassigned generic parameters? False
- List type arguments (1):
- System.Int32
-
-Here it is: 42
-
-Here it is: 42
-
-The definition is the same: True
-
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp
deleted file mode 100644
index f498738331b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-// System.Reflection.Emit.ModuleBuilder
-/*
-The following example demonstrates the 'ModuleBuilder' class.
-A dynamic assembly with a module in it is created in 'CodeGenerator' class.
-A run time class having a method and a field is created using the 'ModuleBuilder'
-class and created class is called from the 'TestClass'.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-public ref class CodeGenerator
-{
-private:
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- CodeGenerator()
- {
- // Get the current application domain for the current thread.
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define a dynamic assembly in the current application domain.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Define a dynamic module in this assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
-
- // Define a runtime class with specified name and attributes.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public );
-
- // Add 'Greeting' field to the class, with the specified attribute and type.
- FieldBuilder^ greetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public );
- array^myMethodArgs = {String::typeid};
-
- // Add 'MyMethod' method to the class, with the specified attribute and signature.
- MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, CallingConventions::Standard, nullptr, myMethodArgs );
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->EmitWriteLine( "In the method..." );
- methodIL->Emit( OpCodes::Ldarg_0 );
- methodIL->Emit( OpCodes::Ldarg_1 );
- methodIL->Emit( OpCodes::Stfld, greetingField );
- methodIL->Emit( OpCodes::Ret );
- myTypeBuilder->CreateType();
- }
-
- property AssemblyBuilder^ MyAssembly
- {
- AssemblyBuilder^ get()
- {
- return this->myAssemblyBuilder;
- }
- }
-};
-
-int main()
-{
- CodeGenerator^ myCodeGenerator = gcnew CodeGenerator;
-
- // Get the assembly builder for 'myCodeGenerator' object.
- AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyAssembly;
-
- // Get the module builder for the above assembly builder object .
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->GetDynamicModule( "TempModule" );
- Console::WriteLine( "The fully qualified name and path to this module is :{0}", myModuleBuilder->FullyQualifiedName );
- Type^ myType = myModuleBuilder->GetType( "TempClass" );
- MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" );
-
- // Get the token used to identify the method within this module.
- MethodToken myMethodToken = myModuleBuilder->GetMethodToken( myMethodInfo );
- Console::WriteLine( "Token used to identify the method of 'myType'"
- " within the module is {0:x}", myMethodToken.Token );
- array^args = {"Hello."};
- Object^ myObject = Activator::CreateInstance( myType, nullptr, nullptr );
- myMethodInfo->Invoke( myObject, args );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp
deleted file mode 100644
index 3979e2356e6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// System.Reflection.Emit.ModuleBuilder.DefineGlobalMethod(String,MethodAttributes,Type,Type[])
-// System.Reflection.Emit.ModuleBuilder.CreateGlobalFunctions
-
-/*
-The following example demonstrates the 'DefineGlobalMethod(String,MethodAttributes,Type,Type[])'
-and 'CreateGlobalFunctions' methods of 'ModuleBuilder' class.
-A dynamic assembly with a module in it is created in 'CodeGenerator' class. Then a global method
-is created in the module using the 'DefineGlobalMethod' method. The global method is called from
-the 'CallerClass'.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class CodeGenerator
-{
-private:
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- CodeGenerator()
- {
- myModuleBuilder = nullptr;
- myAssemblyBuilder = nullptr;
-
- //
- //
- AppDomain^ currentDomain;
- AssemblyName^ myAssemblyName;
- MethodBuilder^ myMethodBuilder = nullptr;
- ILGenerator^ myILGenerator;
-
- // Get the current application domain for the current thread.
- currentDomain = AppDomain::CurrentDomain;
- myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define a dynamic assembly in the 'currentDomain'.
- myAssemblyBuilder =
- currentDomain->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Define a dynamic module in "TempAssembly" assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
-
- // Define a global method in the 'TempModule' module.
- myMethodBuilder = myModuleBuilder->DefineGlobalMethod(
- "MyMethod1", (MethodAttributes)(MethodAttributes::Static | MethodAttributes::Public),
- nullptr, nullptr );
- myILGenerator = myMethodBuilder->GetILGenerator();
- myILGenerator->EmitWriteLine( "Hello World from global method." );
- myILGenerator->Emit( OpCodes::Ret );
-
- // Fix up the 'TempModule' module .
- myModuleBuilder->CreateGlobalFunctions();
- //
- //
- }
-
- property AssemblyBuilder^ MyAssembly
- {
- AssemblyBuilder^ get()
- {
- return this->myAssemblyBuilder;
- }
- }
-};
-
-int main()
-{
- CodeGenerator^ myGenerator = gcnew CodeGenerator;
- AssemblyBuilder^ myAssembly = myGenerator->MyAssembly;
- ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" );
- Console::WriteLine( "Invoking the global method..." );
- MethodInfo^ myMethodInfo = myBuilder->GetMethod( "MyMethod1" );
- myMethodInfo->Invoke( nullptr, nullptr );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp
deleted file mode 100644
index b40b5fe22cc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-void main()
-{
- // Get the current application domain for the current thread.
- AppDomain^ currentDomain = AppDomain::CurrentDomain;
-
- // Create a dynamic assembly in the current application domain,
- // and allow it to be executed and saved to disk.
- AssemblyName^ aName = gcnew AssemblyName("TempAssembly");
- AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly(
- aName, AssemblyBuilderAccess::RunAndSave);
-
- // Define a dynamic module in "TempAssembly" assembly. For a single-
- // module assembly, the module has the same name as the assembly.
- ModuleBuilder^ mb =
- ab->DefineDynamicModule(aName->Name, aName->Name + ".dll");
-
- // Define a public enumeration with the name "Elevation" and an
- // underlying type of Int32.
- EnumBuilder^ eb =
- mb->DefineEnum("Elevation", TypeAttributes::Public, int::typeid);
-
- // Define two members, "High" and "Low".
- eb->DefineLiteral("Low", (Object^) 0);
- eb->DefineLiteral("High", 1);
-
- // Create the type and save the assembly.
- Type^ finished = eb->CreateType();
- ab->Save(aName->Name + ".dll");
-
- for each (Object^ o in Enum::GetValues(finished))
- {
- Console::WriteLine("{0}.{1} = {2}", finished, o, (int)o);
- }
-}
-
-/* This code example produces the following output:
-
-Elevation.Low = 0
-Elevation.High = 1
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp
deleted file mode 100644
index d87da81e582..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// System.Reflection.Emit.ModuleBuilder.DefineInitializedData
-
-/*
-The following example demonstrates the 'DefineInitializedData' method of
-'ModuleBuilder' class.
-A dynamic assembly with a module in it is created in 'CodeGenerator' class.
-A initialized data field is created using 'DefineInitializedData'
-method for creating the initialized data.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class CodeGenerator
-{
-private:
- ModuleBuilder^ myModuleBuilder;
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- CodeGenerator()
- {
- //
- AppDomain^ currentDomain;
- AssemblyName^ myAssemblyName;
-
- // Get the current application domain for the current thread.
- currentDomain = AppDomain::CurrentDomain;
- myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define a dynamic assembly in the 'currentDomain'.
- myAssemblyBuilder =
- currentDomain->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Define a dynamic module in "TempAssembly" assembly.
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" );
-
- // Define the initialized data field in the .sdata section of the PE file.
- array^ temp0 = {01,00,01};
- FieldBuilder^ myFieldBuilder =
- myModuleBuilder->DefineInitializedData( "MyField", temp0,
- (FieldAttributes)(FieldAttributes::Static | FieldAttributes::Public) );
- myModuleBuilder->CreateGlobalFunctions();
- //
- }
-
- property AssemblyBuilder^ MyAssembly
- {
- AssemblyBuilder^ get()
- {
- return this->myAssemblyBuilder;
- }
- }
-};
-
-int main()
-{
- CodeGenerator^ myGenerator = gcnew CodeGenerator;
- AssemblyBuilder^ myAssembly = myGenerator->MyAssembly;
- ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" );
- FieldInfo^ myInfo = myBuilder->GetField( "MyField" );
- Console::WriteLine( "The name of the initialized data field is :" + myInfo->Name );
- Console::WriteLine( "The object having the field value is :" + myInfo->GetValue( myBuilder ) );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp
deleted file mode 100644
index 3e81dcf0345..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// System.Reflection.Emit.ModuleBuilder.DefinePInvokeMethod(String,String,MethodAttributes,
-// CallingConventions,Type,Type[],CallingConvention,CharSet)
-/*
- The following example demonstrates that DefinePInvokeMethod doesn't work unless you
- add a DLLImportAttribute...which you can do just as well with DefineGlobalMethod.
-
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Runtime::InteropServices;
-
-const int MB_RETRYCANCEL = 5;
-
-void main()
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName("TempAssembly");
-
- // Define a dynamic assembly in the current application domain.
- AssemblyBuilder^ myAssemblyBuilder =
- AppDomain::CurrentDomain->DefineDynamicAssembly(
- myAssemblyName, AssemblyBuilderAccess::Run);
-
- // Define a dynamic module in "TempAssembly" assembly.
- ModuleBuilder^ myModuleBuilder =
- myAssemblyBuilder->DefineDynamicModule("TempModule");
-
- array^ paramTypes =
- { int::typeid, String::typeid, String::typeid, int::typeid };
-
- // Define a PInvoke method.
- MethodBuilder^ piMethodBuilder = myModuleBuilder->DefinePInvokeMethod(
- "MessageBoxA",
- "user32.dll",
- MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl,
- CallingConventions::Standard,
- int::typeid,
- paramTypes,
- CallingConvention::Winapi,
- CharSet::Ansi);
-
- // Add PreserveSig to the method implementation flags. NOTE: If this line
- // is commented out, the return value will be zero when the method is
- // invoked.
- piMethodBuilder->SetImplementationFlags(
- piMethodBuilder->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig);
-
- // Create global methods.
- myModuleBuilder->CreateGlobalFunctions();
-
- // Arguments for calling the method.
- array^ arguments =
- { (Object^)(int) 0, "Hello World", "Title", MB_RETRYCANCEL };
-
- MethodInfo^ pinvokeMethod = myModuleBuilder->GetMethod("MessageBoxA");
- Console::WriteLine("Testing module-level PInvoke method created with DefinePInvokeMethod...");
- Console::WriteLine("Message box returned: {0}",
- pinvokeMethod->Invoke(nullptr, arguments));
-};
-
-
-/* This code example produces input similar to the following:
-
-Testing module-level PInvoke method created with DefinePInvokeMethod...
-Message box returned: 4
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp
deleted file mode 100644
index 8cbc472c421..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String)
-/*
-The following example demonstrates the 'DefineResource(String, String)' method
-of 'ModuleBuilder' class.
-A dynamic assembly with a module in it is created in 'CodeGenerator' class.
-Then a managed resource is defined in the module using the 'DefineResource'
-method.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Resources;
-public ref class CodeGenerator
-{
-public:
- CodeGenerator()
- {
-
- // Get the current application domain for the current thread.
- AppDomain^ currentDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define 'TempAssembly' assembly in the current application domain.
- AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Define 'TempModule' module in 'TempAssembly' assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true );
-
- // Define the managed embedded resource, 'MyResource' in 'TempModule'.
- IResourceWriter^ myResourceWriter = myModuleBuilder->DefineResource( "MyResource.resource", "Description" );
-
- // Add resources to the resource writer.
- myResourceWriter->AddResource( "String 1", "First String" );
- myResourceWriter->AddResource( "String 2", "Second String" );
- myResourceWriter->AddResource( "String 3", "Third String" );
- myAssemblyBuilder->Save( "MyAssembly.dll" );
- }
-
-};
-
-int main()
-{
- CodeGenerator^ myGenerator = gcnew CodeGenerator;
- Console::WriteLine( "A resource named 'MyResource.resource' has been created and can be viewed in the 'MyAssembly.dll'" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp
deleted file mode 100644
index 5caa523989d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String, ResourceAttributes)
-/*
-The following example demonstrates the 'DefineResource(String, String, ResourceAttributes)'
-method of 'ModuleBuilder' class.
-A dynamic assembly with a module in it is created in 'CodeGenerator' class.
-Then a managed resource is defined in the module using the 'DefineResource' method.
-*/
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Resources;
-public ref class CodeGenerator
-{
-public:
- CodeGenerator()
- {
-
- // Get the current application domain for the current thread.
- AppDomain^ currentDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define 'TempAssembly' assembly in the current application domain.
- AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Define 'TempModule' module in 'TempAssembly' assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true );
-
- // Define the managed embedded resource, 'MyResource' in 'TempModule'
- // with the specified attribute.
- IResourceWriter^ writer = myModuleBuilder->DefineResource( "MyResource.resource", "Description", ResourceAttributes::Public );
-
- // Add resources to the resource writer.
- writer->AddResource( "String 1", "First String" );
- writer->AddResource( "String 2", "Second String" );
- writer->AddResource( "String 3", "Third String" );
- myAssemblyBuilder->Save( "MyAssembly.dll" );
- }
-
-};
-
-int main()
-{
- CodeGenerator^ myGenerator = gcnew CodeGenerator;
- Console::WriteLine( "A resource named 'MyResource::resource' has been created and can be viewed in the 'MyAssembly.dll'" );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp
deleted file mode 100644
index 574e5fa1686..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// System.Reflection.Emit.ModuleBuilder.GetArrayMethod
-// System.Reflection.Emit.ModuleBuilder.GetArrayMethodToken
-
-/*
-The following example demonstrates 'GetArrayMethod' and 'GetArrayMethodToken'
-methods of 'ModuleBuilder' class.
-A dynamic assembly with a module having a runtime class, 'TempClass' is created.
-This class defines a method, 'SortArray', which sorts the elements of the array
-passed to it. The 'GetArrayMethod' method is used to obtain the 'MethodInfo' object
-corresponding to the 'Sort' method of the 'Array'. The token used to identify the 'Sort'
-method in dynamic module is displayed using 'GetArrayMethodToken' method.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class CodeGenerator
-{
-private:
- AssemblyBuilder^ myAssemblyBuilder;
-
-public:
- CodeGenerator()
- {
- AppDomain^ myCurrentDomain = AppDomain::CurrentDomain;
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "TempAssembly";
-
- // Define a dynamic assembly in the current application domain.
- myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
-//
-//
- // Define a dynamic module in "TempAssembly" assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->
- DefineDynamicModule( "TempModule" );
-
- // Define a runtime class with specified name and attributes.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType(
- "TempClass", TypeAttributes::Public );
- array^ paramArray = { Array::typeid };
- // Add 'SortArray' method to the class, with the given signature.
- MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "SortArray",
- MethodAttributes::Public, Array::typeid, paramArray );
-
- array^ myArrayClass = gcnew array( 1 );
- array^ parameterTypes = { Array::typeid };
- // Get the 'MethodInfo' object corresponding to 'Sort' method of 'Array' class.
- MethodInfo^ myMethodInfo = myModuleBuilder->GetArrayMethod(
- myArrayClass->GetType(), "Sort", CallingConventions::Standard,
- nullptr, parameterTypes );
-
- // Get the token corresponding to 'Sort' method of 'Array' class.
- MethodToken myMethodToken = myModuleBuilder->GetArrayMethodToken(
- myArrayClass->GetType(), "Sort", CallingConventions::Standard,
- nullptr, parameterTypes );
- Console::WriteLine( "Token used by module to identify the 'Sort' method"
- + " of 'Array' class is : {0:x} ", myMethodToken.Token );
-
- ILGenerator^ methodIL = myMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldarg_1 );
- methodIL->Emit( OpCodes::Call, myMethodInfo );
- methodIL->Emit( OpCodes::Ldarg_1 );
- methodIL->Emit( OpCodes::Ret );
-
- // Complete the creation of type.
- myTypeBuilder->CreateType();
- //
- //
- }
-
- property AssemblyBuilder^ MyBuilder
- {
- AssemblyBuilder^ get()
- {
- return this->myAssemblyBuilder;
- }
- }
-};
-
-int main()
-{
- CodeGenerator^ myCodeGenerator = gcnew CodeGenerator;
- AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyBuilder;
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->
- GetDynamicModule( "TempModule" );
- Type^ myType = myModuleBuilder->GetType( "TempClass" );
- Object^ myObject = Activator::CreateInstance( myType );
- MethodInfo^ sortArray = myType->GetMethod( "SortArray" );
- if ( nullptr != sortArray )
- {
- array^ arrayToSort = {"I","am","not","sorted"};
- Console::WriteLine( "Array elements before sorting " );
- for ( int i = 0; i < arrayToSort->Length; i++ )
- {
- Console::WriteLine( "Array element {0} : {1} ", i, arrayToSort[ i ] );
- }
- array^arguments = {arrayToSort};
- Console::WriteLine( "Invoking our dynamically "
- + "created SortArray method..." );
- Object^ myOutput = sortArray->Invoke( myObject, arguments );
- array^ mySortedArray = ( array^ )myOutput;
- Console::WriteLine( "Array elements after sorting " );
- for ( int i = 0; i < mySortedArray->Length; i++ )
- {
- Console::WriteLine( "Array element {0} : {1} ", i, mySortedArray[ i ] );
- }
- }
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp
deleted file mode 100644
index a0934b9b3d7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-// System::Reflection::ParameterInfo::Attributes
-/*
- The following example displays the attributes associated with the
- parameters of the method called 'MyMethod' of class 'ParameterInfo_Example'.
- */
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class MyClass1
-{
-public:
- int MyMethod( int i, [Out]short * j, long * k )
- {
- *j = 2;
- return 0;
- }
-
-};
-
-void main()
-{
- // Get the type.
- Type^ myType = MyClass1::typeid;
-
- // Get the method named 'MyMethod' from the type.
- MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" );
-
- // Get the parameters associated with the method.
- array^myParameters = myMethodBase->GetParameters();
- Console::WriteLine( "\nThe method {0} has the {1} parameters :", "ParameterInfo_Example::MyMethod", myParameters->Length );
-
- // Print the attributes associated with each of the parameters.
- for ( int i = 0; i < myParameters->Length; i++ )
- Console::WriteLine( "\tThe {0} parameter has the attribute : {1}", i + 1, myParameters[ i ]->Attributes );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp
deleted file mode 100644
index 06e6497934c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// System::Reflection::ParameterInfo::GetCustomAttributes(Type, bool)
-// System::Reflection::ParameterInfo::IsDefined(Type, bool)
-using namespace System;
-using namespace System::Reflection;
-
-// Define a custom attribute with one named parameter.
-[AttributeUsage(AttributeTargets::Parameter)]
-public ref class MyAttribute: public Attribute
-{
-private:
- String^ myName;
-
-public:
- MyAttribute( String^ name )
- {
- myName = name;
- }
-
- property String^ Name
- {
- String^ get()
- {
- return myName;
- }
- }
-};
-
-// Derive another custom attribute from MyAttribute.
-[AttributeUsage(AttributeTargets::Parameter)]
-public ref class MyDerivedAttribute: public MyAttribute
-{
-public:
- MyDerivedAttribute( String^ name ) : MyAttribute( name ) {}
-};
-
-// Define a class with a method that has three parameters. Apply
-// MyAttribute to one parameter, MyDerivedAttribute to another, and
-// no attributes to the third.
-public ref class MyClass1
-{
-public:
- void MyMethod( [MyAttribute("This is an example parameter attribute")]
- int i,
- [MyDerivedAttribute("This is another parameter attribute")]
- int j,
- int k ){}
-};
-
-void main()
-{
- // Get the type of the class 'MyClass1'.
- Type^ myType = MyClass1::typeid;
-
- // Get the members associated with the class 'MyClass1'.
- array^myMethods = myType->GetMethods();
-
- // For each method of the class 'MyClass1', display all the parameters
- // to which MyAttribute or its derived types have been applied.
- for each ( MethodInfo^ mi in myMethods )
- {
- // Get the parameters for the method.
- array^ myParameters = mi->GetParameters();
- if ( myParameters->Length > 0 )
- {
- Console::WriteLine("\nThe following parameters of {0} have MyAttribute or a derived type:", mi);
- for each ( ParameterInfo^ pi in myParameters)
- {
- if (pi->IsDefined(MyAttribute::typeid, false))
- {
- Console::WriteLine("Parameter {0}, name = {1}, type = {2}",
- pi->Position, pi->Name, pi->ParameterType);
- }
- }
- }
- }
-}
-
-/* This code example produces the following output:
-
-The following parameters of Void MyMethod(Int32, Int32, Int32) have MyAttribute or a derived type:
-Parameter 0, name = i, type = System.Int32
-Parameter 1, name = j, type = System.Int32
-
-The following parameters of Boolean Equals(System.Object) have MyAttribute or a derived type:
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp
deleted file mode 100644
index f864dfbd878..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a custom attribute with one named parameter.
-[AttributeUsage(AttributeTargets::Parameter)]
-public ref class MyAttribute: public Attribute
-{
-private:
- String^ myName;
-
-public:
- MyAttribute( String^ name )
- {
- myName = name;
- }
-
- property String^ Name
- {
- String^ get()
- {
- return myName;
- }
- }
-};
-
-// Define a class which has a custom attribute associated with one of the
-// parameters of a method.
-public ref class MyClass1
-{
-public:
- void MyMethod(
- [MyAttribute("This is an example parameter attribute")]
- int i ) {}
-};
-
-void main()
-{
- // Get the type of the class 'MyClass1'.
- Type^ myType = MyClass1::typeid;
-
- // Get the members associated with the class 'MyClass1'.
- array^myMethods = myType->GetMethods();
-
- // Display the attributes for each of the parameters of each method of the class 'MyClass1'.
- for ( int i = 0; i < myMethods->Length; i++ )
- {
- // Get the parameters for the method.
- array^myParameters = myMethods[ i ]->GetParameters();
-
- if ( myParameters->Length > 0 )
- {
- Console::WriteLine( "\nThe parameters for the method \"{0}\" that have custom attributes are:", myMethods[ i ] );
- for ( int j = 0; j < myParameters->Length; j++ )
- {
- // Get the attributes of type 'MyAttribute' for each parameter.
- array^myAttributes = myParameters[ j ]->GetCustomAttributes( MyAttribute::typeid, false );
-
- if ( myAttributes->Length > 0 )
- {
- Console::WriteLine( "Parameter {0}, name = {1}, type = {2} has attributes:",
- myParameters[ j ]->Position,
- myParameters[ j ]->Name,
- myParameters[ j ]->ParameterType );
- for ( int k = 0; k < myAttributes->Length; k++ )
- {
- Console::WriteLine( "\t{0}", myAttributes[ k ] );
- }
- }
- }
- }
- }
-}
-/* This code example produces the following output:
-
-The parameters for the method Void MyMethod(Int32) that have custom attributes are :
-Parameter 0, name = i, type = System.Int32 has attributes:
- MyAttribute
-
-The parameters for the method Boolean Equals(System.Object) that have custom attributes are :
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp
deleted file mode 100644
index c568d6441a6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-
-// System::Reflection::ParameterInfo::IsIn
-// System::Reflection::ParameterInfo::IsOptional
-// System::Reflection::ParameterInfo::IsOut
-/*
-The following program creates a dynamic assembly named 'MyAssembly', defines a
-module named 'MyModule' within the assembly. It defines a type called 'MyType'
-within the module and also defines a static method named 'MyMethod' for the
-type. This dynamic assembly is then queried for the type defined within it and
-then the attributes of all the parameters of the method named 'MyMethod' is
-displayed.
-*/
-//
-//
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Threading;
-using namespace System::Reflection::Emit;
-void DefineMethod()
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "MyAssembly";
-
- // Get the assembly builder from the application domain associated with the current thread.
- AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
-
- // Create a dynamic module in the assembly.
- ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", "MyAssembly.dll" );
-
- // Create a type in the module.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" );
-
- // Create a method called MyMethod.
- array^type1 = {int::typeid,short::typeid,long::typeid};
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), String::typeid, type1 );
-
- // Set the attributes for the parameters of the method.
- // Set the attribute for the first parameter to IN.
- ParameterBuilder^ myParameterBuilder = myMethodBuilder->DefineParameter( 1, ParameterAttributes::In, "MyIntParameter" );
-
- // Set the attribute for the second parameter to OUT.
- myParameterBuilder = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "MyShortParameter" );
-
- // Set the attribute for the third parameter to OPTIONAL.
- myParameterBuilder = myMethodBuilder->DefineParameter( 3, static_cast(ParameterAttributes::Optional | ParameterAttributes::HasDefault), "MyLongParameter" );
-
- // Get the Microsoft Intermediate Language generator for the method.
- ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator();
-
- // Use the utility method to generate the MSIL instructions that print a String* to the console.
- myILGenerator->EmitWriteLine( "Hello World!" );
-
- // Generate the S"ret" MSIL instruction.
- myILGenerator->Emit( OpCodes::Ret );
-
- // End the creation of the type.
- myTypeBuilder->CreateType();
-}
-
-int main()
-{
- // Create a dynamic assembly with a type named MyType.
- DefineMethod();
-
- // Get the assemblies currently loaded in the application domain.
- array^myAssemblies = Thread::GetDomain()->GetAssemblies();
- Assembly^ myAssembly = nullptr;
-
- // Get the assembly named MyAssembly.
- for ( int i = 0; i < myAssemblies->Length; i++ )
- if ( String::Compare( myAssemblies[ i ]->GetName( false )->Name, "MyAssembly" ) == 0 )
- myAssembly = myAssemblies[ i ];
-
- if ( myAssembly != nullptr )
- {
- // Get a type named MyType.
- Type^ myType = myAssembly->GetType( "MyType" );
-
- // Get a method named MyMethod from the type.
- MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" );
-
- // Get the parameters associated with the method.
- array^myParameters = myMethodBase->GetParameters();
- Console::WriteLine( "\nThe method {0} has the {1} parameters :", myMethodBase, myParameters->Length );
-
- // Print the IN, OUT and OPTIONAL attributes associated with each of the parameters.
- for ( int i = 0; i < myParameters->Length; i++ )
- {
- if ( myParameters[ i ]->IsIn )
- Console::WriteLine( "\tThe {0} parameter has the In attribute", i + 1 );
- if ( myParameters[ i ]->IsOptional )
- Console::WriteLine( "\tThe {0} parameter has the Optional attribute", i + 1 );
- if ( myParameters[ i ]->IsOut )
- Console::WriteLine( "\tThe {0} parameter has the Out attribute", i + 1 );
- }
- }
- else
- Console::WriteLine( "Could not find a assembly named 'MyAssembly' for the current application domain" );
-}
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp
deleted file mode 100644
index f64e0f64c9b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-
-// System.Reflection.Emit.PropertyBuilder.SetGetMethod
-// System.Reflection.Emit.PropertyBuilder.SetSetMethod
-// System.Reflection.Emit.PropertyBuilder.AddOtherMethod
-// System.Reflection.Emit.PropertyBuilder
-/*
-This following program demonstrates methods 'SetGetMethod','SetSetMethod' and
-'AddOtherMethod' of class 'PropertyBuilder'.
-
-A dynamic assembly is generated with a class having a property 'Greeting'.
-Its 'get' and 'set' method are created by returning and setting a string respectively.
-This property value is reset with default string using othermethod.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-// Create the callee transient dynamic assembly.
-Type^ CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess access )
-{
- // Create a simple name for the callee assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the callee dynamic assembly.
- AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, access );
-
- // Create a dynamic module named "EmittedModule" in the callee assembly.
- ModuleBuilder^ myModule;
- if ( access == AssemblyBuilderAccess::Run )
- {
- myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" );
- }
- else
- {
- myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" );
- }
-
- //
- TypeBuilder^ helloWorldTypeBuilder = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define a private String field named "m_greeting" in "HelloWorld" class.
- FieldBuilder^ greetingFieldBuilder = helloWorldTypeBuilder->DefineField( "m_greeting", String::typeid, FieldAttributes::Private );
-
- // Create constructor args and define constructor.
- array^constructorArgs = {String::typeid};
- ConstructorBuilder^ constructor = helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs );
-
- // Generate IL code for the method. The constructor stores its argument in the private field.
- ILGenerator^ constructorIL = constructor->GetILGenerator();
- constructorIL->Emit( OpCodes::Ldarg_0 );
- constructorIL->Emit( OpCodes::Ldarg_1 );
- constructorIL->Emit( OpCodes::Stfld, greetingFieldBuilder );
- constructorIL->Emit( OpCodes::Ret );
-
- //
- // Define property Greeting.
- PropertyBuilder^ greetingPropertyBuilder = helloWorldTypeBuilder->DefineProperty( "Greeting", PropertyAttributes::None, String::typeid, nullptr );
-
- // Define the 'get_Greeting' method.
- MethodBuilder^ getGreetingMethod = helloWorldTypeBuilder->DefineMethod( "get_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), String::typeid, nullptr );
-
- // Generate IL code for 'get_Greeting' method.
- ILGenerator^ methodIL = getGreetingMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldarg_0 );
- methodIL->Emit( OpCodes::Ldfld, greetingFieldBuilder );
- methodIL->Emit( OpCodes::Ret );
- greetingPropertyBuilder->SetGetMethod( getGreetingMethod );
- //
-
-
- // Define the set_Greeting method.
- array^methodArgs = {String::typeid};
- MethodBuilder^ setGreetingMethod = helloWorldTypeBuilder->DefineMethod( "set_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), void::typeid, methodArgs );
-
- // Generate IL code for set_Greeting method.
- methodIL = setGreetingMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldarg_0 );
- methodIL->Emit( OpCodes::Ldarg_1 );
- methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder );
- methodIL->Emit( OpCodes::Ret );
- greetingPropertyBuilder->SetSetMethod( setGreetingMethod );
- //
-
- //
- // Define the reset_Greeting method.
- MethodBuilder^ otherGreetingMethod = helloWorldTypeBuilder->DefineMethod( "reset_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig), void::typeid, nullptr );
-
- // Generate IL code for reset_Greeting method.
- methodIL = otherGreetingMethod->GetILGenerator();
- methodIL->Emit( OpCodes::Ldarg_0 );
- methodIL->Emit( OpCodes::Ldstr, "Default String." );
- methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder );
- methodIL->Emit( OpCodes::Ret );
- greetingPropertyBuilder->AddOtherMethod( otherGreetingMethod );
- //
-
- // Create the class HelloWorld.
- return (helloWorldTypeBuilder->CreateType());
-}
-
-int main()
-{
- // Create the "HelloWorld" type in an assembly with mode 'RunAndSave'.
- Type^ helloWorldType = CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave );
-
- // Create an instance of the "HelloWorld" class.
- array^temp0 = {"HelloWorld"};
- Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 );
- Object^ returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr );
- Console::WriteLine( "HelloWorld.GetGreeting returned: \"{0}\"", returnValue );
-
- // Set 'Greeting' property with 'NewMessage!!!'.
- array^temp1 = {"New Message !!!"};
- helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::SetProperty), nullptr, helloWorld, temp1 );
- returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr );
- Console::WriteLine( "After Set operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue );
-
- // Reset 'Greeting' property to 'Default String'.
- helloWorldType->InvokeMember( "reset_Greeting", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr );
- returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr );
- Console::WriteLine( "After Reset operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue );
- AssemblyBuilder^ myAssembly = dynamic_cast(helloWorldType->Assembly);
-
- // Save to disk.
- myAssembly->Save( "EmittedAssembly.dll" );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp
deleted file mode 100644
index 3ec2d28a977..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections::Generic;
-
-ref class Example
-{
-private:
- int static _sharedProperty = 41;
- int _instanceProperty;
- Dictionary^ _indexedInstanceProperty;
-
-public:
- Example()
- {
- _instanceProperty = 42;
- _indexedInstanceProperty = gcnew Dictionary();
- };
-
- static property int SharedProperty
- {
- int get() { return _sharedProperty; }
- void set(int value) { _sharedProperty = value; }
- };
-
- property int InstanceProperty
- {
- int get() { return _instanceProperty; }
- void set(int value) { _instanceProperty = value; }
- };
-
- // By default, the name of the default indexed property (class
- // indexer) is Item, and that name must be used to search for the
- // property with reflection. The property can be given a different
- // name by using the IndexerNameAttribute attribute.
- property String^ default[int]
- {
- String^ get(int key)
- {
- String^ returnValue;
- if (_indexedInstanceProperty->TryGetValue(key, returnValue))
- {
- return returnValue;
- }
- else
- {
- return nullptr;
- }
- }
- void set(int key, String^ value)
- {
- if (value == nullptr)
- {
- throw gcnew ArgumentNullException(
- "IndexedInstanceProperty value can be an empty string, but it cannot be null.");
- }
- else
- {
- if (_indexedInstanceProperty->ContainsKey(key))
- {
- _indexedInstanceProperty[key] = value;
- }
- else
- {
- _indexedInstanceProperty->Add(key, value);
- }
- }
- }
- };
-};
-
-void main()
-{
- Console::WriteLine("Initial value of class-level property: {0}",
- Example::SharedProperty);
-
- PropertyInfo^ piShared =
- Example::typeid->GetProperty("SharedProperty");
- piShared->SetValue(nullptr, 76, nullptr);
-
- Console::WriteLine("Final value of class-level property: {0}",
- Example::SharedProperty);
-
-
- Example^ exam = gcnew Example();
-
- Console::WriteLine("\nInitial value of instance property: {0}",
- exam->InstanceProperty);
-
- PropertyInfo^ piInstance =
- Example::typeid->GetProperty("InstanceProperty");
- piInstance->SetValue(exam, 37, nullptr);
-
- Console::WriteLine("Final value of instance property: {0}",
- exam->InstanceProperty);
-
-
- exam[17] = "String number 17";
- exam[46] = "String number 46";
- exam[9] = "String number 9";
-
- Console::WriteLine(
- "\nInitial value of indexed instance property(17): '{0}'",
- exam[17]);
-
- // By default, the name of the default indexed property (class
- // indexer) is Item, and that name must be used to search for the
- // property with reflection. The property can be given a different
- // name by using the IndexerNameAttribute attribute.
- PropertyInfo^ piIndexedInstance =
- Example::typeid->GetProperty("Item");
- piIndexedInstance->SetValue(
- exam,
- "New value for string number 17",
- gcnew array { 17 });
-
- Console::WriteLine("Final value of indexed instance property(17): '{0}'",
- exam[17]);
-};
-
-/* This example produces the following output:
-
-Initial value of class-level property: 41
-Final value of class-level property: 76
-
-Initial value of instance property: 42
-Final value of instance property: 37
-
-Initial value of indexed instance property(17): 'String number 17'
-Final value of indexed instance property(17): 'New value for string number 17'
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp
deleted file mode 100644
index f6ea3e649aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-ref class Example
-{
-private:
- int static _sharedProperty = 41;
- int _instanceProperty;
-
-
-public:
- Example()
- {
- _instanceProperty = 42;
- };
-
- static property int SharedProperty
- {
- int get() { return _sharedProperty; }
- void set(int value) { _sharedProperty = value; }
- };
-
- property int InstanceProperty
- {
- int get() { return _instanceProperty; }
- void set(int value) { _instanceProperty = value; }
- };
-
-};
-
-void main()
-{
- Console::WriteLine("Initial value of static property: {0}",
- Example::SharedProperty);
-
- PropertyInfo^ piShared =
- Example::typeid->GetProperty("SharedProperty");
- piShared->SetValue(nullptr, 76, nullptr);
-
- Console::WriteLine("New value of static property: {0}",
- Example::SharedProperty);
-
-
- Example^ exam = gcnew Example();
-
- Console::WriteLine("\nInitial value of instance property: {0}",
- exam->InstanceProperty);
-
- PropertyInfo^ piInstance =
- Example::typeid->GetProperty("InstanceProperty");
- piInstance->SetValue(exam, 37, nullptr);
-
- Console::WriteLine("New value of instance property: {0}",
- exam->InstanceProperty);
-};
-
-/* The example displays the following output:
- Initial value of static property: 41
- New value of static property: 76
-
- Initial value of instance property: 42
- New value of instance property: 37
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp
deleted file mode 100644
index 28a75c1bc29..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Globalization;
-
-// Declare a delegate type that can be used to execute the completed
-// dynamic method.
-private delegate int HelloDelegate(String^ msg, int ret);
-
-void main()
-{
- // Create an array that specifies the types of the parameters
- // of the dynamic method. This dynamic method has a String
- // parameter and an Integer parameter.
- array^ helloArgs = { String::typeid, int::typeid };
-
- // Create a dynamic method with the name "Hello", a return type
- // of Integer, and two parameters whose types are specified by
- // the array helloArgs. Create the method in the module that
- // defines the String class.
- DynamicMethod^ hello = gcnew DynamicMethod("Hello",
- int::typeid,
- helloArgs,
- String::typeid->Module);
-
- //
- // Create an array that specifies the parameter types of the
- // overload of Console::WriteLine to be used in Hello.
- array^ writeStringArgs = { String::typeid };
- // Get the overload of Console::WriteLine that has one
- // String parameter.
- MethodInfo^ writeString = Console::typeid->GetMethod("WriteLine",
- writeStringArgs);
-
- // Get an ILGenerator and emit a body for the dynamic method,
- // using a stream size larger than the IL that will be
- // emitted.
- ILGenerator^ il = hello->GetILGenerator(256);
- // Load the first argument, which is a string, onto the stack.
- il->Emit(OpCodes::Ldarg_0);
- // Call the overload of Console::WriteLine that prints a string.
- il->EmitCall(OpCodes::Call, writeString, nullptr);
- // The Hello method returns the value of the second argument;
- // to do this, load the onto the stack and return.
- il->Emit(OpCodes::Ldarg_1);
- il->Emit(OpCodes::Ret);
- //
-
- //
- // Add parameter information to the dynamic method. (This is not
- // necessary, but can be useful for debugging.) For each parameter,
- // identified by position, supply the parameter attributes and a
- // parameter name.
- hello->DefineParameter(1, ParameterAttributes::In, "message");
- hello->DefineParameter(2, ParameterAttributes::In, "valueToReturn");
- //
-
- //
- // Create a delegate that represents the dynamic method. This
- // action completes the method. Any further attempts to
- // change the method are ignored.
- HelloDelegate^ hi =
- (HelloDelegate^) hello->CreateDelegate(HelloDelegate::typeid);
-
- // Use the delegate to execute the dynamic method.
- Console::WriteLine("\r\nUse the delegate to execute the dynamic method:");
- int retval = hi("\r\nHello, World!", 42);
- Console::WriteLine("Invoking delegate hi(\"Hello, World!\", 42) returned: " + retval);
-
- // Execute it again, with different arguments.
- retval = hi("\r\nHi, Mom!", 5280);
- Console::WriteLine("Invoking delegate hi(\"Hi, Mom!\", 5280) returned: " + retval);
- //
-
- //
- Console::WriteLine("\r\nUse the Invoke method to execute the dynamic method:");
- // Create an array of arguments to use with the Invoke method.
- array^ invokeArgs = { "\r\nHello, World!", 42 };
- // Invoke the dynamic method using the arguments. This is much
- // slower than using the delegate, because you must create an
- // array to contain the arguments, and value-type arguments
- // must be boxed.
- Object^ objRet = hello->Invoke(nullptr, BindingFlags::ExactBinding, nullptr, invokeArgs, gcnew CultureInfo("en-us"));
- Console::WriteLine("hello.Invoke returned: " + objRet);
- //
-
- Console::WriteLine("\r\n ----- Display information about the dynamic method -----");
- //
- // Display MethodAttributes for the dynamic method, set when
- // the dynamic method was created.
- Console::WriteLine("\r\nMethod Attributes: {0}", hello->Attributes);
- //
-
- //
- // Display the calling convention of the dynamic method, set when the
- // dynamic method was created.
- Console::WriteLine("\r\nCalling convention: {0}", hello->CallingConvention);
- //
-
- //
- // Display the declaring type, which is always null for dynamic
- // methods.
- if (hello->DeclaringType == nullptr)
- {
- Console::WriteLine("\r\nDeclaringType is always null for dynamic methods.");
- }
- else
- {
- Console::WriteLine("DeclaringType: {0}", hello->DeclaringType);
- }
- //
-
- //
- // Display the default value for InitLocals.
- if (hello->InitLocals)
- {
- Console::Write("\r\nThis method contains verifiable code.");
- }
- else
- {
- Console::Write("\r\nThis method contains unverifiable code.");
- }
- Console::WriteLine(" (InitLocals = {0})", hello->InitLocals);
- //
-
- //
- // Display the module specified when the dynamic method was created.
- Console::WriteLine("\r\nModule: {0}", hello->Module);
- //
-
- //
- // Display the name specified when the dynamic method was created.
- // Note that the name can be blank.
- Console::WriteLine("\r\nName: {0}", hello->Name);
- //
-
- //
- // For dynamic methods, the reflected type is always null.
- if (hello->ReflectedType == nullptr)
- {
- Console::WriteLine("\r\nReflectedType is null.");
- }
- else
- {
- Console::WriteLine("\r\nReflectedType: {0}", hello->ReflectedType);
- }
- //
-
- //
- if (hello->ReturnParameter == nullptr)
- {
- Console::WriteLine("\r\nMethod has no return parameter.");
- }
- else
- {
- Console::WriteLine("\r\nReturn parameter: {0}", hello->ReturnParameter);
- }
- //
-
- //
- // If the method has no return type, ReturnType is System.Void.
- Console::WriteLine("\r\nReturn type: {0}", hello->ReturnType);
- //
-
- //
- // ReturnTypeCustomAttributes returns an ICustomeAttributeProvider
- // that can be used to enumerate the custom attributes of the
- // return value. At present, there is no way to set such custom
- // attributes, so the list is empty.
- if (hello->ReturnType == Void::typeid)
- {
- Console::WriteLine("The method has no return type.");
- }
- else
- {
- ICustomAttributeProvider^ caProvider = hello->ReturnTypeCustomAttributes;
- array^ returnAttributes = caProvider->GetCustomAttributes(true);
- if (returnAttributes->Length == 0)
- {
- Console::WriteLine("\r\nThe return type has no custom attributes.");
- }
- else
- {
- Console::WriteLine("\r\nThe return type has the following custom attributes:");
- for each (Object^ attr in returnAttributes)
- {
- Console::WriteLine("\t{0}", attr->ToString());
- }
- }
- }
- //
-
- //
- Console::WriteLine("\r\nToString: {0}", hello->ToString());
- //
-
- //
- // Display parameter information.
- array^ parameters = hello->GetParameters();
- Console::WriteLine("\r\nParameters: name, type, ParameterAttributes");
- for each (ParameterInfo^ p in parameters)
- {
- Console::WriteLine("\t{0}, {1}, {2}",
- p->Name, p->ParameterType, p->Attributes);
- }
- //
-}
-
-/* This code example produces the following output:
-
-Use the delegate to execute the dynamic method:
-
-Hello, World!
-Invoking delegate hi("Hello, World!", 42) returned: 42
-
-Hi, Mom!
-Invoking delegate hi("Hi, Mom!", 5280) returned: 5280
-
-Use the Invoke method to execute the dynamic method:
-
-Hello, World!
-hello.Invoke returned: 42
-
- ----- Display information about the dynamic method -----
-
-Method Attributes: PrivateScope, Public, Static
-
-Calling convention: Standard
-
-DeclaringType is always null for dynamic methods.
-
-This method contains verifiable code. (InitLocals = True)
-
-Module: CommonLanguageRuntimeLibrary
-
-Name: Hello
-
-ReflectedType is null.
-
-Method has no return parameter.
-
-Return type: System.Int32
-
-The return type has no custom attributes.
-
-ToString: Int32 Hello(System.String, Int32)
-
-Parameters: name, type, ParameterAttributes
- message, System.String, In
- valueToReturn, System.Int32, In
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp
deleted file mode 100644
index 86d3112fd26..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class Test
-{
-};
-
-// Declare a delegate that will be used to execute the completed
-// dynamic method.
-delegate int HelloInvoker(String^ msg, int ret);
-
-int main()
-{
- // Create an array that specifies the types of the parameters
- // of the dynamic method. This method has a string parameter
- // and an int parameter.
- array^ helloArgs = {String::typeid, int::typeid};
-
- // Create a dynamic method with the name "Hello", a return type
- // of int, and two parameters whose types are specified by the
- // array helloArgs. Create the method in the module that
- // defines the Test class.
- DynamicMethod^ hello = gcnew DynamicMethod("Hello",
- int::typeid,
- helloArgs,
- Test::typeid->Module);
-
- //
- // Create an array that specifies the parameter types of the
- // overload of Console.WriteLine to be used in Hello.
- array^ writeStringArgs = {String::typeid};
- // Get the overload of Console.WriteLine that has one
- // String parameter.
- MethodInfo^ writeString =
- Console::typeid->GetMethod("WriteLine", writeStringArgs);
-
- // Get an ILGenerator and emit a body for the dynamic method.
- ILGenerator^ ilgen = hello->GetILGenerator();
- // Load the first argument, which is a string, onto the stack.
- ilgen->Emit(OpCodes::Ldarg_0);
- // Call the overload of Console.WriteLine that prints a string.
- ilgen->EmitCall(OpCodes::Call, writeString, nullptr);
- // The Hello method returns the value of the second argument;
- // to do this, load the onto the stack and return.
- ilgen->Emit(OpCodes::Ldarg_1);
- ilgen->Emit(OpCodes::Ret);
- //
-
- //
- // Create a delegate that represents the dynamic method. This
- // action completes the method, and any further attempts to
- // change the method will cause an exception.
- HelloInvoker^ helloDelegate =
- (HelloInvoker^) hello->CreateDelegate(HelloInvoker::typeid);
- //
-
- // Use the delegate to execute the dynamic method. Save and
- // print the return value.
- int returnValue = helloDelegate("\r\nHello, World!", 42);
- Console::WriteLine("helloDelegate(\"Hello, World!\", 42) returned {0}",
- returnValue);
-
- // Do it again, with different arguments.
- returnValue = helloDelegate("\r\nHi, Mom!", 5280);
- Console::WriteLine("helloDelegate(\"Hi, Mom!\", 5280) returned {0}",
- returnValue);
-
- //
- // Create an array of arguments to use with the Invoke method.
- array^ delegateArgs = {"\r\nHello, World!", 42};
- // Invoke the dynamic method using the arguments. This is much
- // slower than using the delegate, because you must create an
- // array to contain the arguments, and ValueType arguments
- // must be boxed.
- Object^ returnValueObject = hello->Invoke(nullptr, delegateArgs);
- Console::WriteLine("hello.Invoke returned {0}", returnValueObject);
- //
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp
deleted file mode 100644
index f6f2d74c1e0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-static void Display(Int32 indent, String^ format, ... array^param)
-{
- Console::Write("{0}", gcnew String (' ', indent));
- Console::WriteLine(format, param);
-}
-
-// Displays the custom attributes applied to the specified member.
-static void DisplayAttributes(Int32 indent, MemberInfo^ mi)
-{
- // Get the set of custom attributes; if none exist, just return.
- array^attrs = mi->GetCustomAttributes(false);
-
- if (attrs->Length==0)
- {
- return;
- }
-
- // Display the custom attributes applied to this member.
- Display(indent+1, "Attributes:");
- for each ( Object^ o in attrs )
- {
- Display(indent*2, "{0}", o);
- }
-}
-
-void main()
-{
- try
- {
- // This variable holds the amount of indenting that
- // should be used when displaying each line of information.
- Int32 indent = 0;
- // Display information about the EXE assembly.
- //
- Assembly^ a = System::Reflection::Assembly::GetExecutingAssembly();
-
- Display(indent, "Assembly identity={0}", gcnew array {a->FullName});
- Display(indent+1, "Codebase={0}", gcnew array {a->CodeBase});
-
- // Display the set of assemblies our assemblies reference.
-
- Display(indent, "Referenced assemblies:");
-
- for each ( AssemblyName^ an in a->GetReferencedAssemblies() )
- {
- Display(indent + 1, "Name={0}, Version={1}, Culture={2}, PublicKey token={3}", gcnew array {an->Name, an->Version, an->CultureInfo, (BitConverter::ToString(an->GetPublicKeyToken()))});
- }
- //
- Display(indent, "");
- // Display information about each assembly loading into this AppDomain.
- for each ( Assembly^ b in AppDomain::CurrentDomain->GetAssemblies())
- {
- Display(indent, "Assembly: {0}", gcnew array {b});
- // Display information about each module of this assembly.
-
- for each ( Module^ m in b->GetModules(true) )
- {
- Display(indent+1, "Module: {0}", gcnew array {m->Name});
- }
- // Display information about each type exported from this assembly.
-
- indent += 1;
- for each ( Type^ t in b->GetExportedTypes() )
- {
- Display(0, "");
- Display(indent, "Type: {0}", gcnew array {t});
-
- // For each type, show its members & their custom attributes.
-
- indent += 1;
- for each (MemberInfo^ mi in t->GetMembers() )
- {
- Display(indent, "Member: {0}", gcnew array {mi->Name});
- DisplayAttributes(indent, mi);
-
- // If the member is a method, display information about its parameters.
- if (mi->MemberType==MemberTypes::Method)
- {
-
- for each ( ParameterInfo^ pi in (((MethodInfo^) mi)->GetParameters()))
- {
- Display(indent+1, "Parameter: Type={0}, Name={1}", gcnew array {pi->ParameterType, pi->Name});
- }
- }
-
- // If the member is a property, display information about the property's accessor methods.
- if (mi->MemberType==MemberTypes::Property)
- {
- for each ( MethodInfo^ am in (((PropertyInfo^) mi)->GetAccessors()) )
- {
- Display(indent+1, "Accessor method: {0}", gcnew array {am});
- }
- }
- }
- // Display a formatted string indented by the specified amount.
- indent -= 1;
- }
- indent -= 1;
- }
- }
- catch (Exception^ e)
- {
- Console::WriteLine(e->Message);
- }
-}
-
-// The output shown below is abbreviated.
-//
-//Assembly identity=Reflection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-// Codebase=file:///C:/Reflection.exe
-//Referenced assemblies:
-// Name=mscorlib, Version=1.0.5000.0, Culture=, PublicKey token=B7-7A-5C-56-19-34-E0-89
-// Name=Microsoft.VisualBasic, Version=7.0.5000.0, Culture=, PublicKey token=B0-3F-5F-7F-11-D5-0A-3A
-//
-//Assembly: mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-// Module: mscorlib.dll
-// Module: prc.nlp
-// Module: prcp.nlp
-// Module: ksc.nlp
-// Module: ctype.nlp
-// Module: xjis.nlp
-// Module: bopomofo.nlp
-// Module: culture.nlp
-// Module: region.nlp
-// Module: sortkey.nlp
-// Module: charinfo.nlp
-// Module: big5.nlp
-// Module: sorttbls.nlp
-// Module: l_intl.nlp
-// Module: l_except.nlp
-//
-// Type: System.Object
-// Member: GetHashCode
-// Member: Equals
-// Parameter: Type=System.Object, Name=obj
-// Member: ToString
-// Member: Equals
-// Parameter: Type=System.Object, Name=objA
-// Parameter: Type=System.Object, Name=objB
-// Member: ReferenceEquals
-// Parameter: Type=System.Object, Name=objA
-// Parameter: Type=System.Object, Name=objB
-// Member: GetType
-// Member: .ctor
-//
-// Type: System.ICloneable
-// Member: Clone
-//
-// Type: System.Collections.IEnumerable
-// Member: GetEnumerator
-// Attributes:
-// System.Runtime.InteropServices.DispIdAttribute
-//
-// Type: System.Collections.ICollection
-// Member: get_IsSynchronized
-// Member: get_SyncRoot
-// Member: get_Count
-// Member: CopyTo
-// Parameter: Type=System.Array, Name=array
-// Parameter: Type=System.Int32, Name=index
-// Member: Count
-// Accessor method: Int32 get_Count()
-// Member: SyncRoot
-// Accessor method: System.Object get_SyncRoot()
-// Member: IsSynchronized
-// Accessor method: Boolean get_IsSynchronized()
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp b/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp
deleted file mode 100644
index 97c560511ad..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//Types:System.Reflection.StrongNameKeyPair
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Reflection;
-
-ref class snkX
-{
-public:
- static void Main()
- {
- // Open a file that contains a public key value. The line below
- // assumes that the Strong Name tool (SN.exe) was executed from
- // a command prompt as follows:
- // SN.exe -k C:\Company.keys
- FileStream^ fs = File::Open("C:\\Company.keys", FileMode::Open);
-
- //
- // Construct a StrongNameKeyPair object. This object should obtain
- // the public key from the Company.keys file.
- StrongNameKeyPair^ k = gcnew StrongNameKeyPair(fs);
- //
-
- //
- // Display the bytes that make up the public key.
- Console::WriteLine(BitConverter::ToString(k->PublicKey));
- //
-
- // Close the file.
- fs->Close();
- }
-};
-
-int main()
-{
- snkX::Main();
-}
-
-// Output will vary by user.
-//
-// 00-24-00-00-04-80-00-00-94-69-89-78-BB-F1-F2-71-00-00-00-34-26-
-// 69-89-78-BB-F1-F2-71-00-F1-FA-F2-F9-4A-A8-5E-82-55-AB-49-4D-A6-
-// ED-AB-5F-CE-DE-59-49-8D-63-01-B0-E1-BF-43-07-FA-55-D4-36-75-EE-
-// 8B-83-32-39-B7-02-DE-3D-81-29-7B-E8-EA-F0-2E-78-94-96-F1-73-79-
-// 69-89-78-BB-F1-F2-71-0E-4E-F4-5D-DD-A4-7F-11-54-DF-65-DE-89-23-
-// 91-AD-53-E1-C0-DA-9E-0C-88-BE-AA-7B-39-20-9C-9B-55-34-26-3B-1A-
-// 53-41-31-00-04-00-00-01-00-01-00-9D-F1-EA-14-4C-88-34-26-3B-1A-
-// 2D-D7-A0-AB-F6-7E-B7-24-7F-87-DF-3E-97
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp
deleted file mode 100644
index c9151536fe5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public interface class I
-{
- void M();
-};
-
-public ref class A
-{
-public:
- virtual void M() { Console::WriteLine("In method A.M"); }
-};
-
-// The object of this code example is to emit code equivalent to
-// the following C++ code:
-//
-public ref class C : A, I
-{
-public:
- virtual void M() override
- {
- Console::WriteLine("Overriding A.M from C.M");
- }
-
-private:
- // In order to provide a different implementation from C.M when
- // emitting the following explicit interface implementation,
- // it is necessary to use a MethodImpl.
- //
- virtual void IM() sealed = I::M
- {
- Console::WriteLine("The I::M implementation of C");
- }
-};
-
-void main()
-{
- String^ name = "DefineMethodOverrideExample";
- AssemblyName^ asmName = gcnew AssemblyName(name);
- AssemblyBuilder^ ab =
- AppDomain::CurrentDomain->DefineDynamicAssembly(
- asmName, AssemblyBuilderAccess::RunAndSave);
- ModuleBuilder^ mb = ab->DefineDynamicModule(name, name + ".dll");
-
- TypeBuilder^ tb =
- mb->DefineType("C", TypeAttributes::Public, A::typeid);
- tb->AddInterfaceImplementation(I::typeid);
-
- // Build the method body for the explicit interface
- // implementation. The name used for the method body
- // can be anything. Here, it is the name of the method,
- // qualified by the interface name.
- //
- MethodBuilder^ mbIM = tb->DefineMethod("I.M",
- MethodAttributes::Private | MethodAttributes::HideBySig |
- MethodAttributes::NewSlot | MethodAttributes::Virtual |
- MethodAttributes::Final,
- nullptr,
- Type::EmptyTypes);
- ILGenerator^ il = mbIM->GetILGenerator();
- il->Emit(OpCodes::Ldstr, "The I.M implementation of C");
- il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine",
- gcnew array { String::typeid }));
- il->Emit(OpCodes::Ret);
-
- // DefineMethodOverride is used to associate the method
- // body with the interface method that is being implemented.
- //
- tb->DefineMethodOverride(mbIM, I::typeid->GetMethod("M"));
-
- MethodBuilder^ mbM = tb->DefineMethod("M",
- MethodAttributes::Public | MethodAttributes::ReuseSlot |
- MethodAttributes::Virtual | MethodAttributes::HideBySig,
- nullptr,
- Type::EmptyTypes);
- il = mbM->GetILGenerator();
- il->Emit(OpCodes::Ldstr, "Overriding A.M from C.M");
- il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine",
- gcnew array { String::typeid }));
- il->Emit(OpCodes::Ret);
-
- Type^ tc = tb->CreateType();
-
- // Save the emitted assembly, to examine with Ildasm.exe.
- ab->Save(name + ".dll");
-
- Object^ test = Activator::CreateInstance(tc);
-
- MethodInfo^ mi = I::typeid->GetMethod("M");
- mi->Invoke(test, nullptr);
-
- mi = A::typeid->GetMethod("M");
- mi->Invoke(test, nullptr);
-}
-
-/* This code example produces the following output:
-
-The I.M implementation of C
-Overriding A.M from C.M
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp
deleted file mode 100644
index 6ea81968d31..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-// System::Reflection::Emit::TypeBuilder.AddDeclarativeSecurity
-/* The following example demonstrates method AddDeclarativeSecurity
-of 'TypeBuilder' class.
-The program creates a dynamic assembly and a type in it having support for declarative security.
-It demands an Environmentpermission read access on 'TEMP'.
-Caller (main) is able to create an instance successfully with
-default permission(as local machine executes with full trust permission set).
-*/
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-
-int main()
-{
- // Create a simple name for the assembly; create the assembly and module.
- AssemblyName^ myAssemblyName = gcnew AssemblyName("EmittedAssembly");
- AssemblyBuilder^ myAssemblyBuilder =
- AppDomain::CurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ myModuleBuilder =
- myAssemblyBuilder->DefineDynamicModule( "EmittedAssembly", "EmittedAssembly.dll");
-
- // Define a public class named "MyDynamicClass" in the assembly.
- TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public );
-
-
- // Create a permission set and add a security permission
- // with the ControlEvidence flag.
- //
- PermissionSet^ myPermissionSet = gcnew PermissionSet(PermissionState::None);
- myPermissionSet->AddPermission(
- gcnew SecurityPermission(SecurityPermissionFlag::ControlEvidence));
-
- // Add the permission set to the MyDynamicClass type,
- // as a declarative security demand.
- //
- myTypeBuilder->AddDeclarativeSecurity(SecurityAction::Demand, myPermissionSet);
-
-
- Type^ myType = myTypeBuilder->CreateType();
- myAssemblyBuilder->Save("EmittedAssembly.dll");
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp
deleted file mode 100644
index c19e9adcb71..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-
-// System.Reflection.Emit.TypeBuilder.DefineNestedType(string, TypeAttributes, Type, Type[])
-// System.Reflection.Emit.TypeBuilder.DefineMethodOverride(MethodInfo, MethodInfo)
-// System.Reflection.Emit.TypeBuilder.DefineMethod(string, MethodAttributes,Type,Type[])
-/*
-The following program demonstrates the 'DefineNestedType', 'DefineMethodOverride' and
-'DefineMethod' methods of 'TypeBuilder' class. It builds an assembly by defining
-'MyHelloWorld' type. 'MyHelloWorld' class has a nested class 'MyNestedClass' which extends
-'EmittedClass' and implements 'IMyInterface' interface. Then it creates and instance of
-'MyNestedClass' type and calls the 'HelloMethod' using 'IMyInterface' object and
-results are displayed to the console.
-*/
-//
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-public interface class IMyInterface
-{
- String^ HelloMethod( String^ parameter );
-};
-
-public ref class EmittedClass
-{
-public:
- // Because this method calls Activator::CreateInstance,
- // it requires full trust.
- [System::Security::Permissions::PermissionSetAttribute
- (System::Security::Permissions::SecurityAction::Demand, Name = "FullTrust")]
- static void Main()
- {
- Type^ myNestedClassType = CreateCallee( Thread::GetDomain() );
-
- // Create an instance of 'MyNestedClass'.
- IMyInterface^ myInterface = dynamic_cast(Activator::CreateInstance( myNestedClassType ));
- Console::WriteLine( myInterface->HelloMethod( "Bill" ) );
- }
-
-private:
-
- // Create the callee transient dynamic assembly.
- static Type^ CreateCallee( AppDomain^ myAppDomain )
- {
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedClass";
-
- // Create the callee dynamic assembly.
- AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module in the callee assembly.
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "MyHelloWorld".
- TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public );
-
- // Define a public nested class named 'MyNestedClass'.
- array^temp0 = {IMyInterface::typeid};
- TypeBuilder^ myNestedClassType = myHelloWorldType->DefineNestedType( "MyNestedClass", TypeAttributes::NestedPublic, EmittedClass::typeid, temp0 );
-
- // Implement 'IMyInterface' interface.
- myNestedClassType->AddInterfaceImplementation( IMyInterface::typeid );
-
- // Define 'HelloMethod' of 'IMyInterface'.
- array^temp1 = {String::typeid};
- MethodBuilder^ myHelloMethod = myNestedClassType->DefineMethod( "HelloMethod", static_cast(MethodAttributes::Public | MethodAttributes::Virtual), String::typeid, temp1 );
-
- // Generate IL for 'GetGreeting' method.
- ILGenerator^ myMethodIL = myHelloMethod->GetILGenerator();
- myMethodIL->Emit( OpCodes::Ldstr, "Hi! " );
- myMethodIL->Emit( OpCodes::Ldarg_1 );
- array^temp2 = {String::typeid,String::typeid};
- MethodInfo^ infoMethod = String::typeid->GetMethod( "Concat", temp2 );
- myMethodIL->Emit( OpCodes::Call, infoMethod );
- myMethodIL->Emit( OpCodes::Ret );
- MethodInfo^ myHelloMethodInfo = IMyInterface::typeid->GetMethod( "HelloMethod" );
-
- // Implement 'HelloMethod' of 'IMyInterface'.
- myNestedClassType->DefineMethodOverride( myHelloMethod, myHelloMethodInfo );
-
- // Create 'MyHelloWorld' type.
- Type^ myType = myHelloWorldType->CreateType();
-
- // Create 'MyNestedClass' type.
- return myNestedClassType->CreateType();
- }
-};
-
-int main()
-{
- EmittedClass::Main();
-}
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp
deleted file mode 100644
index 15212e47056..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Runtime::InteropServices;
-
- void main()
- {
- // Create the AssemblyBuilder.
- AssemblyName^ asmName = gcnew AssemblyName("PInvokeTest");
- AssemblyBuilder^ dynamicAsm = AppDomain::CurrentDomain->DefineDynamicAssembly(
- asmName,
- AssemblyBuilderAccess::RunAndSave
- );
-
- // Create the module.
- ModuleBuilder^ dynamicMod =
- dynamicAsm->DefineDynamicModule(asmName->Name, asmName->Name + ".dll");
-
- // Create the TypeBuilder for the class that will contain the
- // signature for the PInvoke call.
- TypeBuilder^ tb = dynamicMod->DefineType(
- "MyType",
- TypeAttributes::Public | TypeAttributes::UnicodeClass
- );
-
- MethodBuilder^ mb = tb->DefinePInvokeMethod(
- "GetTickCount",
- "Kernel32.dll",
- MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl,
- CallingConventions::Standard,
- int::typeid,
- Type::EmptyTypes,
- CallingConvention::Winapi,
- CharSet::Ansi);
-
- // Add PreserveSig to the method implementation flags. NOTE: If this line
- // is commented out, the return value will be zero when the method is
- // invoked.
- mb->SetImplementationFlags(
- mb->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig);
-
- // The PInvoke method does not have a method body.
-
- // Create the class and test the method.
- Type^ t = tb->CreateType();
-
- MethodInfo^ mi = t->GetMethod("GetTickCount");
- Console::WriteLine("Testing PInvoke method...");
- Console::WriteLine("GetTickCount returned: {0}", mi->Invoke(nullptr, nullptr));
-
- // Produce the .dll file.
- Console::WriteLine("Saving: " + asmName->Name + ".dll");
- dynamicAsm->Save(asmName->Name + ".dll");
- };
-
-/* This example produces output similar to the following:
-
-Testing PInvoke method...
-GetTickCount returned: 1314410994
-Saving: PInvokeTest.dll
- */
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp
deleted file mode 100644
index ad88d21ef91..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-// System::Reflection::Emit::TypeBuilder::DefineUninitializedData(string,int,FieldAttributes)
-/*
-The following program demonstrates the 'DefineUninitializedData'
-method of 'TypeBuilder' class. It builds an assembly by defining 'MyHelloWorld' type and
-it has 'MyGreeting' field. Then it displays the initial value of 'MyGreeting'
-field to the console.
-*/
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Runtime::InteropServices;
-using namespace System::Security::Permissions;
-
-public ref class Example
-{
-public:
- [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
- static void Main()
- {
- Type^ myHelloWorldType = CreateCallee( Thread::GetDomain() );
- Object^ myHelloWorldInstance = Activator::CreateInstance( myHelloWorldType );
- FieldInfo^ myGreetingFieldInfo = myHelloWorldType->GetField( "MyGreeting" );
- Object^ oval = Activator::CreateInstance( myGreetingFieldInfo->FieldType );
- IntPtr myIntPtr = Marshal::AllocHGlobal( 4 );
- Random^ rand = gcnew Random;
- int iTempSeed = rand->Next();
- array^bINITBYTE = GetRandBytes( iTempSeed, 4 );
- IntPtr intptrTemp = myIntPtr;
- for ( int j = 0; j < 4; j++ )
- {
- Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] );
- myIntPtr = (IntPtr)((int)myIntPtr + 1);
-
- }
- myIntPtr = intptrTemp;
- Object^ oValNew = Marshal::PtrToStructure( myIntPtr, myGreetingFieldInfo->FieldType );
- Marshal::FreeHGlobal( myIntPtr );
- myIntPtr = Marshal::AllocHGlobal( 4 );
- Object^ myObj = myGreetingFieldInfo->GetValue( myHelloWorldInstance );
- Marshal::StructureToPtr( myObj, myIntPtr, true );
- intptrTemp = myIntPtr;
- Console::WriteLine( "The value of 'MyGreeting' field : " );
- for ( int j = 0; j < 4; j++ )
- {
- Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] );
- Console::WriteLine( bINITBYTE[ j ] );
- myIntPtr = (IntPtr)((int)myIntPtr + 1);
-
- }
- }
-
-
-private:
- static array^ GetRandBytes( int iRandSeed, int iSize )
- {
- array^barr = gcnew array(iSize);
- Random^ randTemp = gcnew Random( iRandSeed );
- randTemp->NextBytes( barr );
- return barr;
- }
-
-
- // Create the callee transient dynamic assembly.
- static Type^ CreateCallee( AppDomain^ myDomain )
- {
-
- // Create a simple name for the callee assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedClass";
-
- // Create the callee dynamic assembly.
- AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module in the callee assembly.
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "MyHelloWorld"
- TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public );
-
- // Define a 'MyGreeting' field and initialize it.
- FieldBuilder^ myFieldBuilder = myHelloWorldType->DefineUninitializedData( "MyGreeting", 4, FieldAttributes::Public );
-
- // Create the 'MyHelloWorld' class.
- return (myHelloWorldType->CreateType());
- }
-
-};
-
-int main()
-{
- Example::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp
deleted file mode 100644
index e35e284ec04..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-// System::Reflection::Emit::TypeBuilder.GetEvents(BindingFlags)
-/*
-The program demonstrates the 'GetEvents' method of the 'TypeBuilder' class.
-It builds an assembly by defining 'HelloWorld' type and creates a 'Click' and
-'MouseUp' events on the type. Then displays all events to the Console.
-*/
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-ref class MyApplication
-{
-private:
- delegate void MyEvent( Object^ temp );
-
-public:
-
- // Create the callee transient dynamic assembly.
- static TypeBuilder^ CreateCallee( AppDomain^ myDomain )
- {
- AssemblyName^ assemblyName = gcnew AssemblyName;
- assemblyName->Name = "EmittedAssembly";
-
- // Create the callee dynamic assembly.
- AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
- array^typeArray = gcnew array(1);
- typeArray[ 0 ] = Object::typeid;
- MethodBuilder^ myMethod1 = helloWorldClass->DefineMethod( "OnClick", MethodAttributes::Public, void::typeid, typeArray );
- ILGenerator^ methodIL1 = myMethod1->GetILGenerator();
- methodIL1->Emit( OpCodes::Ret );
- MethodBuilder^ myMethod2 = helloWorldClass->DefineMethod( "OnMouseUp", MethodAttributes::Public, void::typeid, typeArray );
- ILGenerator^ methodIL2 = myMethod2->GetILGenerator();
- methodIL2->Emit( OpCodes::Ret );
-
- // Create the events.
- EventBuilder^ myEvent1 = helloWorldClass->DefineEvent( "Click", EventAttributes::None, MyEvent::typeid );
- myEvent1->SetRaiseMethod( myMethod1 );
- EventBuilder^ myEvent2 = helloWorldClass->DefineEvent( "MouseUp", EventAttributes::None, MyEvent::typeid );
- myEvent2->SetRaiseMethod( myMethod2 );
- helloWorldClass->CreateType();
- return (helloWorldClass);
- }
-};
-
-int main()
-{
- TypeBuilder^ helloWorldClass = MyApplication::CreateCallee( Thread::GetDomain() );
- array^info = helloWorldClass->GetEvents( static_cast(BindingFlags::Public | BindingFlags::Instance) );
- Console::WriteLine( "'HelloWorld' type has following events :" );
- for ( int i = 0; i < info->Length; i++ )
- Console::WriteLine( info[ i ]->Name );
- return 0;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp
deleted file mode 100644
index a6d8a10bd75..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-// System.Reflection.Emit.TypeBuilder.FullName
-// System.Reflection.Emit.TypeBuilder.GetConstructors
-// System.Reflection.Emit.TypeBuilder.DefineTypeInitializer
-/*
-The following program demonstrates DefineTypeInitializer and 'GetConstructors' methods and
-the 'FullName' property of 'TypeBuilder' class. It builds an assembly by defining 'HelloWorld'
-type. It also defines a constructor for 'HelloWorld' type. Then it displays the
-full name of type and its constructors to the console.
-*/
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-//
-//
-//
-// Create the callee transient dynamic assembly.
-TypeBuilder^ CreateCallee( AppDomain^ myDomain )
-{
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
-
- // Create the callee dynamic assembly.
- AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module named "CalleeModule" in the callee assembly.
- ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" );
-
- // Define a public class named "HelloWorld" in the assembly.
- TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Define a private String field named "Greeting" in the type.
- FieldBuilder^ greetingField = helloWorldClass->DefineField( "Greeting", String::typeid, FieldAttributes::Private );
-
- // Create the constructor.
- ConstructorBuilder^ constructor = helloWorldClass->DefineTypeInitializer();
-
- // Generate IL for the method. The constructor calls its base class
- // constructor. The constructor stores its argument in the private field.
- ILGenerator^ constructorIL = constructor->GetILGenerator();
- constructorIL->Emit( OpCodes::Ldarg_0 );
- ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) );
- constructorIL->Emit( OpCodes::Call, superConstructor );
- constructorIL->Emit( OpCodes::Ldarg_0 );
- constructorIL->Emit( OpCodes::Ldarg_1 );
- constructorIL->Emit( OpCodes::Stfld, greetingField );
- constructorIL->Emit( OpCodes::Ret );
- helloWorldClass->CreateType();
- return (helloWorldClass);
-}
-
-int main()
-{
- // Create the "HelloWorld" class
- TypeBuilder^ helloWorldClass = CreateCallee( Thread::GetDomain() );
- Console::WriteLine( "Full Name : {0}", helloWorldClass->FullName );
- Console::WriteLine( "Constructors :" );
- array^info = helloWorldClass->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Instance) );
- for ( int index = 0; index < info->Length; index++ )
- Console::WriteLine( info[ index ] );
-}
-//
-//
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp
deleted file mode 100644
index 073d9d96852..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// System.Reflection.Emit.TypeBuilder.DefineField()
-// System.Reflection.Emit.TypeBuilder.DefineConstructor()
-// System.Reflection.Emit.TypeBuilder.AddInterfaceImplementation()
-// System.Reflection.Emit.TypeBuilder.BaseType
-
-/* The following program demonstrates the property 'BaseType' and methods
- 'DefineField','DefineConstructor','AddInterfaceImplementation' of the
- class 'TypeBuilder'.
- The program creates a dynamic assembly and a type within it called as
- 'HelloWorld' This defines a field and implements an interface.
-*/
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Threading;
-
-// Declare the interface.
-interface class IHello
-{
- void SayHello();
-};
-
-// Create the transient dynamic assembly.
-Type^ CreateDynamicAssembly( AppDomain^ myAppDomain, AssemblyBuilderAccess myAccess )
-{
- // Create a simple name for assembly.
- AssemblyName^ myAssemblyName = gcnew AssemblyName;
- myAssemblyName->Name = "EmittedAssembly";
- // Create the dynamic assembly.
- AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, myAccess );
- // Create a dynamic module named 'CalleeModule' in the assembly.
- ModuleBuilder^ myModuleBuilder;
- myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule",
- "EmittedModule.mod" );
-//
-//
- // Define a public class named 'myHelloWorld' in the assembly.
- TypeBuilder^ helloWorldTypeBuilder =
- myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public );
-
- // Get base type.
- Console::WriteLine( "Base Type :{0}", helloWorldTypeBuilder->BaseType->Name );
-//
-
- // Define 'myGreetingField' field.
- FieldBuilder^ myGreetingField =
- helloWorldTypeBuilder->DefineField( "myGreeting", String::typeid,
- FieldAttributes::Public );
-//
-
-//
- // Define the constructor.
- array^ constructorArgs = {String::typeid};
- ConstructorBuilder^ myConstructorBuilder =
- helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public,
- CallingConventions::Standard, constructorArgs );
- // Generate IL for the method. The constructor stores its argument in the private field.
- ILGenerator^ myConstructorIL = myConstructorBuilder->GetILGenerator();
- myConstructorIL->Emit( OpCodes::Ldarg_0 );
- myConstructorIL->Emit( OpCodes::Ldarg_1 );
- myConstructorIL->Emit( OpCodes::Stfld, myGreetingField );
- myConstructorIL->Emit( OpCodes::Ret );
-//
-
-//
- // Mark the class as implementing 'IHello' interface.
- helloWorldTypeBuilder->AddInterfaceImplementation( IHello::typeid );
- MethodBuilder^ myMethodBuilder =
- helloWorldTypeBuilder->DefineMethod( "SayHello",
- (MethodAttributes)(MethodAttributes::Public | MethodAttributes::Virtual),
- nullptr,
- nullptr );
- // Generate IL for 'SayHello' method.
- ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator();
- myMethodIL->EmitWriteLine( myGreetingField );
- myMethodIL->Emit( OpCodes::Ret );
- MethodInfo^ sayHelloMethod = IHello::typeid->GetMethod( "SayHello" );
- helloWorldTypeBuilder->DefineMethodOverride( myMethodBuilder, sayHelloMethod );
-//
- return (helloWorldTypeBuilder->CreateType());
-}
-
-int main()
-{
- Console::WriteLine( "TypeBuilder Sample" );
- Console::WriteLine( "----------------------" );
-
- // Create 'helloWorldType' .
- Type^ helloWorldType = CreateDynamicAssembly( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave );
-
- // Create an instance of 'HelloWorld' class.
- array^ temp0 = {"Called HelloWorld"};
- Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 );
-
- // Invoke 'SayHello' method.
- helloWorldType->InvokeMember( "SayHello", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr );
-
- // Get defined field in the class.
- Console::WriteLine( "Defined Field :{0}", helloWorldType->GetField( "myGreeting" )->Name );
- AssemblyBuilder^ myAssemblyBuilder = dynamic_cast(helloWorldType->Assembly);
- myAssemblyBuilder->Save( "EmittedAssembly.dll" );
-}
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp
deleted file mode 100644
index 6d911a7f1cd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-public ref class MyClass1
-{
-public:
- MyClass1( int i ){}
-
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyClass1::typeid;
- array^types = gcnew array(1);
- types[ 0 ] = int::typeid;
-
- // Get the public instance constructor that takes an integer parameter.
- ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, CallingConventions::HasThis, types, nullptr );
- if ( constructorInfoObj != nullptr )
- {
- Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is: " );
- Console::WriteLine( constructorInfoObj );
- }
- else
- {
- Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is not available." );
- }
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "ArgumentNullException: {0}", e->Message );
- }
- catch ( ArgumentException^ e )
- {
- Console::WriteLine( "ArgumentException: {0}", e->Message );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "SecurityException: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp
deleted file mode 100644
index b924dff4307..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::IO;
-
-[DefaultMemberAttribute("Age")]
-public ref class MyClass
-{
-public:
- void Name( String^ s ){}
-
-
- property int Age
- {
- int get()
- {
- return 20;
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
- Type^ myType = MyClass::typeid;
- array^memberInfoArray = myType->GetDefaultMembers();
- if ( memberInfoArray->Length > 0 )
- {
- System::Collections::IEnumerator^ myEnum = memberInfoArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- MemberInfo^ memberInfoObj = safe_cast(myEnum->Current);
- Console::WriteLine( "The default member name is: {0}", memberInfoObj );
- }
- }
- else
- {
- Console::WriteLine( "No default members are available." );
- }
- }
- catch ( InvalidOperationException^ e )
- {
- Console::WriteLine( "InvalidOperationException: {0}", e->Message );
- }
- catch ( IOException^ e )
- {
- Console::WriteLine( "IOException: {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "Exception: {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp
deleted file mode 100644
index 552ea842e18..00000000000
--- a/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security;
-using namespace System::Windows::Forms;
-
-int main()
-{
- try
- {
- // Creates a bitmask based on BindingFlags.
- BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public | BindingFlags::NonPublic);
- Type^ myTypeBindingFlags = System::Windows::Forms::Button::typeid;
- EventInfo^ myEventBindingFlags = myTypeBindingFlags->GetEvent( "Click", myBindingFlags );
- if ( myEventBindingFlags != nullptr )
- {
- Console::WriteLine( "Looking for the Click event in the Button class with the specified BindingFlags." );
- Console::WriteLine( myEventBindingFlags );
- }
- else
- Console::WriteLine( "The Click event is not available with the Button class." );
- }
- catch ( SecurityException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( ArgumentNullException^ e )
- {
- Console::WriteLine( "An exception occurred." );
- Console::WriteLine( "Message : {0}", e->Message );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "The following exception was raised : {0}", e->Message );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp
deleted file mode 100644
index 2b2375d4317..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace Ambiguity
-{
- ref class Myambiguous
- {
- public:
-
- //The first overload is typed to an Int32
- static void Mymethod(Int32 number)
- {
- Console::WriteLine("I am from 'Int32' method");
- }
-
- //The second overload is typed to a String^
- static void Mymethod(String^ alpha)
- {
- Console::WriteLine("I am from 'String^' method.");
- }
-
- static void Main()
- {
- try
- {
- //The following does not cause as exception
- Mymethod(2); // goes to Mymethod (Int32)
- Mymethod("3"); // goes to Mymethod (String*)
- Type^ Mytype = Type::GetType("Ambiguity.Myambiguous");
- array^temp0 = {Int32::typeid};
- MethodInfo^ Mymethodinfo32 = Mytype->GetMethod("Mymethod", temp0);
- array^temp1 = {System::String::typeid};
- MethodInfo^ Mymethodinfostr = Mytype->GetMethod("Mymethod", temp1);
-
- //Invoke a method, utilizing a Int32 integer
- array^temp2 = {2};
- Mymethodinfo32->Invoke(nullptr, temp2);
-
- //Invoke the method utilizing a String^
- array^temp3 = {"1"};
- Mymethodinfostr->Invoke(nullptr, temp3);
-
- //The following line causes an ambiguous exception
- MethodInfo^ Mymethodinfo = Mytype->GetMethod("Mymethod");
- }
- catch (AmbiguousMatchException^ ex)
- {
- Console::WriteLine("\n{0}\n{1}", ex->GetType()->FullName, ex->Message);
- }
- catch (...)
- {
- Console::WriteLine("\nSome other exception.");
- }
-
- return;
- }
- };
-}
-
-int main()
-{
- Ambiguity::Myambiguous::Main();
-}
-
-//This code produces the following output:
-//
-// I am from 'Int32' method
-// I am from 'String^' method.
-// I am from 'Int32' method
-// I am from 'String^' method.
-//
-// System.Reflection.AmbiguousMatchException
-// Ambiguous match found.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp
deleted file mode 100644
index bc8df83efca..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-using namespace System;
-
-void PrintValues(array^myArr);
-void PrintValues(array^myArr);
-void main()
-{
- // Creates and initializes a new int array and a new Object array.
- array^myIntArray = { 1,2,3,4,5 };
- array^myObjArray = { 26,27,28,29,30 };
-
- // Prints the initial values of both arrays.
- Console::WriteLine("Initially:");
- Console::Write("int array: ");
- PrintValues(myIntArray);
- Console::Write("Object array:");
- PrintValues(myObjArray);
-
- // Copies the first two elements from the int array to the Object array.
- System::Array::Copy(myIntArray, myObjArray, 2);
-
- // Prints the values of the modified arrays.
- Console::WriteLine("\nAfter copying the first two elements of the int array to the Object array:");
- Console::Write("int array: ");
- PrintValues(myIntArray);
- Console::Write("Object array:");
- PrintValues(myObjArray);
-
- // Copies the last two elements from the Object array to the int array.
- System::Array::Copy(myObjArray, myObjArray->GetUpperBound(0) - 1, myIntArray, myIntArray->GetUpperBound(0) - 1, 2);
-
- // Prints the values of the modified arrays.
- Console::WriteLine("\nAfter copying the last two elements of the Object array to the int array:");
- Console::Write("int array: ");
- PrintValues(myIntArray);
- Console::Write("Object array:");
- PrintValues(myObjArray);
-}
-
-void PrintValues(array^myArr)
-{
- for (int i = 0; i < myArr->Length; i++)
- {
- Console::Write("\t{0}", myArr[i]);
-
- }
- Console::WriteLine();
-}
-
-void PrintValues(array^myArr)
-{
- for (int i = 0; i < myArr->Length; i++)
- {
- Console::Write("\t{0}", myArr[i]);
-
- }
- Console::WriteLine();
-}
-
-
-/*
-This code produces the following output.
-
-Initially:
-int array: 1 2 3 4 5
-Object array: 26 27 28 29 30
-After copying the first two elements of the int array to the Object array:
-int array: 1 2 3 4 5
-Object array: 1 2 28 29 30
-After copying the last two elements of the Object array to the int array:
-int array: 1 2 3 29 30
-Object array: 1 2 28 29 30
-*/
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp
deleted file mode 100644
index 10f90aa8ae1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-using namespace System;
-void PrintValues(Array^ myArr);
-void main()
-{
- // Creates and initializes a new three-dimensional Array instance of type Int32.
- Array^ myArr = Array::CreateInstance( Int32::typeid, 2, 3, 4 );
- for ( int i = myArr->GetLowerBound( 0 ); i <= myArr->GetUpperBound( 0 ); i++ )
- {
- for ( int j = myArr->GetLowerBound( 1 ); j <= myArr->GetUpperBound( 1 ); j++ )
- {
- for ( int k = myArr->GetLowerBound( 2 ); k <= myArr->GetUpperBound( 2 ); k++ )
- myArr->SetValue( (i * 100) + (j * 10) + k, i, j, k );
-
- }
- }
-
- // Displays the properties of the Array.
- Console::WriteLine( "The Array instance has {0} dimension(s) and a total of {1} elements.", myArr->Rank, myArr->Length );
- Console::WriteLine( "\tLength\tLower\tUpper" );
- for ( int i = 0; i < myArr->Rank; i++ )
- {
- Console::Write( "{0}:\t{1}", i, myArr->GetLength( i ) );
- Console::WriteLine( "\t{0}\t{1}", myArr->GetLowerBound( i ), myArr->GetUpperBound( i ) );
-
- }
- Console::WriteLine( "The Array instance contains the following values:" );
- PrintValues( myArr );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- i++;
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The Array instance has 3 dimension(s) and a total of 24 elements.
- Length Lower Upper
- 0: 2 0 1
- 1: 3 0 2
- 2: 4 0 3
- The Array instance contains the following values:
- 0 1 2 3
- 10 11 12 13
- 20 21 22 23
- 100 101 102 103
- 110 111 112 113
- 120 121 122 123
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp
deleted file mode 100644
index 40db20d5eb6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-using namespace System;
-
-public ref class SamplesArray
-{
-public:
- static void Main()
- {
- // Creates and initializes a new Array.
- Array^ myIntArray = Array::CreateInstance(Int32::typeid, 5);
-
- myIntArray->SetValue(8, 0);
- myIntArray->SetValue(2, 1);
- myIntArray->SetValue(6, 2);
- myIntArray->SetValue(3, 3);
- myIntArray->SetValue(7, 4);
-
- // Do the required sort first
- Array::Sort(myIntArray);
-
- // Displays the values of the Array.
- Console::WriteLine("The Int32 array contains the following:");
- PrintValues(myIntArray);
-
- // Locates a specific object that does not exist in the Array.
- Object^ myObjectOdd = 1;
- FindMyObject(myIntArray, myObjectOdd);
-
- // Locates an object that exists in the Array.
- Object^ myObjectEven = 6;
- FindMyObject(myIntArray, myObjectEven);
- }
-
- static void FindMyObject(Array^ myArr, Object^ myObject)
- {
- int myIndex = Array::BinarySearch(myArr, myObject);
- if (myIndex < 0)
- {
- Console::WriteLine("The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex);
- }
- else
- {
- Console::WriteLine("The object to search for ({0}) is at index {1}.", myObject, myIndex);
- }
- }
-
- static void PrintValues(Array^ myArr)
- {
- int i = 0;
- int cols = myArr->GetLength(myArr->Rank - 1);
- for each (Object^ o in myArr)
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
- Console::Write("\t{0}", o);
- }
- Console::WriteLine();
- }
-};
-
-int main()
-{
- SamplesArray::Main();
-}
-// This code produces the following output.
-//
-//The Int32 array contains the following:
-// 2 3 6 7 8
-//The object to search for (1) is not found. The next larger object is at index 0
-//
-//The object to search for (6) is at index 2.
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp
deleted file mode 100644
index 16882781c33..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
-
- // Creates and initializes a new Array instance of type Int32.
- Array^ myIntArray = Array::CreateInstance( Type::GetType( "System.Int32" ), 5 );
- for ( int i = myIntArray->GetLowerBound( 0 ); i <= myIntArray->GetUpperBound( 0 ); i++ )
- myIntArray->SetValue( i + 1, i );
-
- // Creates and initializes a new Array instance of type Object.
- Array^ myObjArray = Array::CreateInstance( Type::GetType( "System.Object" ), 5 );
- for ( int i = myObjArray->GetLowerBound( 0 ); i <= myObjArray->GetUpperBound( 0 ); i++ )
- myObjArray->SetValue( i + 26, i );
-
- // Displays the initial values of both arrays.
- Console::WriteLine( "Int32 array:" );
- PrintValues( myIntArray );
- Console::WriteLine( "Object array:" );
- PrintValues( myObjArray );
-
- // Copies the first element from the Int32 array to the Object array.
- Array::Copy( myIntArray, myIntArray->GetLowerBound( 0 ), myObjArray, myObjArray->GetLowerBound( 0 ), 1 );
-
- // Copies the last two elements from the Object array to the Int32 array.
- Array::Copy( myObjArray, myObjArray->GetUpperBound( 0 ) - 1, myIntArray, myIntArray->GetUpperBound( 0 ) - 1, 2 );
-
- // Displays the values of the modified arrays.
- Console::WriteLine( "Int32 array - Last two elements should now be the same as Object array:" );
- PrintValues( myIntArray );
- Console::WriteLine( "Object array - First element should now be the same as Int32 array:" );
- PrintValues( myObjArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- Int32 array:
- 1 2 3 4 5
- Object array:
- 26 27 28 29 30
- Int32 array - Last two elements should now be the same as Object array:
- 1 2 3 29 30
- Object array - First element should now be the same as Int32 array:
- 1 27 28 29 30
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp
deleted file mode 100644
index 2caab9082ed..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-//
-using namespace System;
-
-void main()
-{
- // Creates and initializes two new Array instances.
- Array^ mySourceArray = Array::CreateInstance(String::typeid, 6);
- mySourceArray->SetValue("three", 0);
- mySourceArray->SetValue("napping", 1);
- mySourceArray->SetValue("cats", 2);
- mySourceArray->SetValue("in", 3);
- mySourceArray->SetValue("the", 4);
- mySourceArray->SetValue("barn", 5);
- Array^ myTargetArray = Array::CreateInstance(String::typeid, 15);
- myTargetArray->SetValue("The", 0);
- myTargetArray->SetValue("quick", 1);
- myTargetArray->SetValue("brown", 2);
- myTargetArray->SetValue("fox", 3);
- myTargetArray->SetValue("jumps", 4);
- myTargetArray->SetValue("over", 5);
- myTargetArray->SetValue("the", 6);
- myTargetArray->SetValue("lazy", 7);
- myTargetArray->SetValue("dog", 8);
-
- // Displays the values of the Array.
- Console::WriteLine( "The target Array instance contains the following (before and after copying):");
- PrintValues(myTargetArray);
-
- // Copies the source Array to the target Array, starting at index 6.
- mySourceArray->CopyTo(myTargetArray, 6);
-
- // Displays the values of the Array.
- PrintValues(myTargetArray);
-}
-
-void PrintValues(Array^ myArr)
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength(myArr->Rank - 1);
- while (myEnumerator->MoveNext())
- {
- if (i < cols)
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( " {0}", myEnumerator->Current);
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The target Array instance contains the following (before and after copying):
- The quick brown fox jumps over the lazy dog
- The quick brown fox jumps over three napping cats in the barn
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp
deleted file mode 100644
index ca74d220df4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-using namespace System;
-
-void main()
-{
- // Creates and initializes the source Array.
- Array^ myArrayZero = Array::CreateInstance(String::typeid, 3);
- myArrayZero->SetValue("zero", 0);
- myArrayZero->SetValue("one", 1);
-
- // Displays the source Array.
- Console::WriteLine("The array with lowbound=0 contains:");
- PrintIndexAndValues(myArrayZero);
-
- // Creates and initializes the target Array.
- array^myArrLen = {4};
- array^myArrLow = {2};
- Array^ myArrayTwo = Array::CreateInstance(String::typeid, myArrLen, myArrLow);
- myArrayTwo->SetValue("two", 2);
- myArrayTwo->SetValue("three", 3);
- myArrayTwo->SetValue("four", 4);
- myArrayTwo->SetValue("five", 5);
-
- // Displays the target Array.
- Console::WriteLine("The array with lowbound=2 contains:");
- PrintIndexAndValues(myArrayTwo);
-
- // Copy from the array with lowbound=0 to the array with lowbound=2.
- myArrayZero->CopyTo(myArrayTwo, 3);
-
- // Displays the modified target Array.
- Console::WriteLine("\nAfter copying at relative index 1:");
- PrintIndexAndValues(myArrayTwo);
-}
-
-void PrintIndexAndValues(Array^ myArray)
-{
- for (int i = myArray->GetLowerBound(0); i <= myArray->GetUpperBound(0); i++)
- Console::WriteLine("\t[{0}]:\t{1}", i, myArray->GetValue(i));
-}
-
-/*
- This code produces the following output.
-
- The array with lowbound=0 contains:
- [0]: zero
- [1]: one
- [2]:
- The array with lowbound=2 contains:
- [2]: two
- [3]: three
- [4]: four
- [5]: five
-
- After copying at relative index 1:
- [2]: two
- [3]: zero
- [4]: one
- [5]:
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp
deleted file mode 100644
index 6fb07cb3bf1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
- // Creates and initializes a one-dimensional Array instance of type Int32.
- Array^ my1DArray = Array::CreateInstance( Int32::typeid, 5 );
- for ( int i = my1DArray->GetLowerBound( 0 ); i <= my1DArray->GetUpperBound( 0 ); i++ )
- my1DArray->SetValue( i + 1, i );
-
- // Displays the values of the Array.
- Console::WriteLine( "The one-dimensional Array instance contains the following values:" );
- PrintValues( my1DArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The one-dimensional Array instance contains the following values:
- 1 2 3 4 5
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp
deleted file mode 100644
index 782e95f0280..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
- // Creates and initializes a two-dimensional Array instance of type String.
- Array^ my2DArray = Array::CreateInstance( String::typeid, 2, 3 );
- for ( int i = my2DArray->GetLowerBound( 0 ); i <= my2DArray->GetUpperBound( 0 ); i++ )
- for ( int j = my2DArray->GetLowerBound( 1 ); j <= my2DArray->GetUpperBound( 1 ); j++ )
- my2DArray->SetValue( String::Concat( "abc", i, j ), i, j );
-
- // Displays the values of the Array.
- Console::WriteLine( "The two-dimensional Array instance contains the following values:" );
- PrintValues( my2DArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The two-dimensional Array instance contains the following values:
- abc00 abc01 abc02
- abc10 abc11 abc12
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp
deleted file mode 100644
index dfc52829993..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
- // Creates and initializes a three-dimensional Array instance of type Object.
- Array^ my3DArray = Array::CreateInstance( Object::typeid, 2, 3, 4 );
- for ( int i = my3DArray->GetLowerBound( 0 ); i <= my3DArray->GetUpperBound( 0 ); i++ )
- for ( int j = my3DArray->GetLowerBound( 1 ); j <= my3DArray->GetUpperBound( 1 ); j++ )
- for ( int k = my3DArray->GetLowerBound( 2 ); k <= my3DArray->GetUpperBound( 2 ); k++ )
- my3DArray->SetValue( String::Concat( "abc", i, j, k ), i, j, k );
-
- // Displays the values of the Array.
- Console::WriteLine( "The three-dimensional Array instance contains the following values:" );
- PrintValues( my3DArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The three-dimensional Array instance contains the following values:
- abc000 abc001 abc002 abc003
- abc010 abc011 abc012 abc013
- abc020 abc021 abc022 abc023
- abc100 abc101 abc102 abc103
- abc110 abc111 abc112 abc113
- abc120 abc121 abc122 abc123
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp
deleted file mode 100644
index cf5aac93295..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
- // Creates and initializes a multidimensional Array instance of type String.
- array^myLengthsArray = {2,3,4,5};
- Array^ my4DArray = Array::CreateInstance( String::typeid, myLengthsArray );
- for ( int i = my4DArray->GetLowerBound( 0 ); i <= my4DArray->GetUpperBound( 0 ); i++ )
- for ( int j = my4DArray->GetLowerBound( 1 ); j <= my4DArray->GetUpperBound( 1 ); j++ )
- for ( int k = my4DArray->GetLowerBound( 2 ); k <= my4DArray->GetUpperBound( 2 ); k++ )
- for ( int l = my4DArray->GetLowerBound( 3 ); l <= my4DArray->GetUpperBound( 3 ); l++ )
- {
- array^myIndicesArray = {i,j,k,l};
- my4DArray->SetValue( String::Concat( Convert::ToString( i ), j, k, l ), myIndicesArray );
-
- }
-
- // Displays the values of the Array.
- Console::WriteLine( "The four-dimensional Array instance contains the following values:" );
- PrintValues( my4DArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- The four-dimensional Array instance contains the following values:
- 0000 0001 0002 0003 0004
- 0010 0011 0012 0013 0014
- 0020 0021 0022 0023 0024
- 0030 0031 0032 0033 0034
- 0100 0101 0102 0103 0104
- 0110 0111 0112 0113 0114
- 0120 0121 0122 0123 0124
- 0130 0131 0132 0133 0134
- 0200 0201 0202 0203 0204
- 0210 0211 0212 0213 0214
- 0220 0221 0222 0223 0224
- 0230 0231 0232 0233 0234
- 1000 1001 1002 1003 1004
- 1010 1011 1012 1013 1014
- 1020 1021 1022 1023 1024
- 1030 1031 1032 1033 1034
- 1100 1101 1102 1103 1104
- 1110 1111 1112 1113 1114
- 1120 1121 1122 1123 1124
- 1130 1131 1132 1133 1134
- 1200 1201 1202 1203 1204
- 1210 1211 1212 1213 1214
- 1220 1221 1222 1223 1224
- 1230 1231 1232 1233 1234
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp
deleted file mode 100644
index cc1ff6dbbc9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-
-//
-using namespace System;
-void PrintValues( Array^ myArr );
-void main()
-{
- // Creates and initializes a multidimensional Array instance of type String.
- array^myLengthsArray = {3,5};
- array^myBoundsArray = {2,3};
- Array^ myArray = Array::CreateInstance( String::typeid, myLengthsArray, myBoundsArray );
- for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ )
- for ( int j = myArray->GetLowerBound( 1 ); j <= myArray->GetUpperBound( 1 ); j++ )
- {
- array^myIndicesArray = {i,j};
- myArray->SetValue( String::Concat( Convert::ToString( i ), j ), myIndicesArray );
-
- }
-
- // Displays the lower bounds and the upper bounds of each dimension.
- Console::WriteLine( "Bounds:\tLower\tUpper" );
- for ( int i = 0; i < myArray->Rank; i++ )
- Console::WriteLine( "{0}:\t{1}\t{2}", i, myArray->GetLowerBound( i ), myArray->GetUpperBound( i ) );
-
- // Displays the values of the Array.
- Console::WriteLine( "The Array instance contains the following values:" );
- PrintValues( myArray );
-}
-
-void PrintValues( Array^ myArr )
-{
- System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator();
- int i = 0;
- int cols = myArr->GetLength( myArr->Rank - 1 );
- while ( myEnumerator->MoveNext() )
- {
- if ( i < cols )
- {
- i++;
- }
- else
- {
- Console::WriteLine();
- i = 1;
- }
-
- Console::Write( "\t{0}", myEnumerator->Current );
- }
-
- Console::WriteLine();
-}
-
-/*
- This code produces the following output.
-
- Bounds: Lower Upper
- 0: 2 4
- 1: 3 7
- The Array instance contains the following values:
- 23 24 25 26 27
- 33 34 35 36 37
- 43 44 45 46 47
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp
deleted file mode 100644
index 18923bcbb6c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-
-//
-using namespace System;
-
-void main()
-{
- // Create a string array with 3 elements having the same value.
- array^ strings = { "the", "quick", "brown", "fox",
- "jumps", "over", "the", "lazy", "dog",
- "in", "the", "barn" };
-
- // Display the elements of the array.
- Console::WriteLine("The array contains the following values:");
- for (int i = strings->GetLowerBound(0); i <= strings->GetUpperBound(0); i++)
- Console::WriteLine(" [{0,2}]: {1}", i, strings[i]);
-
- // Search for the first occurrence of the duplicated value.
- String^ searchString = "the";
- int index = Array::IndexOf(strings, searchString);
- Console::WriteLine("The first occurrence of \"{0}\" is at index {1}.",
- searchString, index);
-
- // Search for the first occurrence of the duplicated value in the last section of the array.
- index = Array::IndexOf( strings, searchString, 4);
- Console::WriteLine("The first occurrence of \"{0}\" between index 4 and the end is at index {1}.",
- searchString, index);
-
- // Search for the first occurrence of the duplicated value in a section of the array.
- int position = index + 1;
- index = Array::IndexOf(strings, searchString, position, strings->GetUpperBound(0) - position + 1);
- Console::WriteLine("The first occurrence of \"{0}\" between index {1} and index {2} is at index {3}.",
- searchString, position, strings->GetUpperBound(0), index);
-}
-// The example displays the following output:
-// The array contains the following values:
-// [ 0]: the
-// [ 1]: quick
-// [ 2]: brown
-// [ 3]: fox
-// [ 4]: jumps
-// [ 5]: over
-// [ 6]: the
-// [ 7]: lazy
-// [ 8]: dog
-// [ 9]: in
-// [10]: the
-// [11]: barn
-// The first occurrence of "the" is at index 0.
-// The first occurrence of "the" between index 4 and the end is at index 6.
-// The first occurrence of "the" between index 7 and index 11 is at index 10.
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp
deleted file mode 100644
index 1b8d7459315..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-
-//
-using namespace System;
-void PrintIndexAndValues( Array^ myArray );
-
-void main()
-{
- // Creates and initializes a new Array instance with three elements of the same value.
- Array^ myArray = Array::CreateInstance( String::typeid, 12 );
- myArray->SetValue( "the", 0 );
- myArray->SetValue( "quick", 1 );
- myArray->SetValue( "brown", 2 );
- myArray->SetValue( "fox", 3 );
- myArray->SetValue( "jumps", 4 );
- myArray->SetValue( "over", 5 );
- myArray->SetValue( "the", 6 );
- myArray->SetValue( "lazy", 7 );
- myArray->SetValue( "dog", 8 );
- myArray->SetValue( "in", 9 );
- myArray->SetValue( "the", 10 );
- myArray->SetValue( "barn", 11 );
-
- // Displays the values of the Array.
- Console::WriteLine( "The Array instance contains the following values:" );
- PrintIndexAndValues( myArray );
-
- // Searches for the last occurrence of the duplicated value.
- String^ myString = "the";
- int myIndex = Array::LastIndexOf( myArray, myString );
- Console::WriteLine( "The last occurrence of \"{0}\" is at index {1}.", myString, myIndex );
-
- // Searches for the last occurrence of the duplicated value in the first section of the Array.
- myIndex = Array::LastIndexOf( myArray, myString, 8 );
- Console::WriteLine( "The last occurrence of \"{0}\" between the start and index 8 is at index {1}.", myString, myIndex );
-
- // Searches for the last occurrence of the duplicated value in a section of the Array.
- // Note that the start index is greater than the end index because the search is done backward.
- myIndex = Array::LastIndexOf( myArray, myString, 10, 6 );
- Console::WriteLine( "The last occurrence of \"{0}\" between index 5 and index 10 is at index {1}.", myString, myIndex );
-}
-
-void PrintIndexAndValues( Array^ myArray )
-{
- for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ )
- Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) );
-}
-
-/*
- This code produces the following output.
-
- The Array instance contains the following values:
- [0]: the
- [1]: quick
- [2]: brown
- [3]: fox
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
- [9]: in
- [10]: the
- [11]: barn
- The last occurrence of "the" is at index 10.
- The last occurrence of "the" between the start and index 8 is at index 6.
- The last occurrence of "the" between index 5 and index 10 is at index 10.
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp
deleted file mode 100644
index 097d0727938..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-
-//
-using namespace System;
-void PrintIndexAndValues( Array^ myArray );
-void main()
-{
- // Creates and initializes a new Array instance.
- Array^ myArray = Array::CreateInstance( String::typeid, 9 );
- myArray->SetValue( "The", 0 );
- myArray->SetValue( "quick", 1 );
- myArray->SetValue( "brown", 2 );
- myArray->SetValue( "fox", 3 );
- myArray->SetValue( "jumps", 4 );
- myArray->SetValue( "over", 5 );
- myArray->SetValue( "the", 6 );
- myArray->SetValue( "lazy", 7 );
- myArray->SetValue( "dog", 8 );
-
- // Displays the values of the Array.
- Console::WriteLine( "The Array instance initially contains the following values:" );
- PrintIndexAndValues( myArray );
-
- // Reverses the sort of the values of the Array.
- Array::Reverse( myArray );
-
- // Displays the values of the Array.
- Console::WriteLine( "After reversing:" );
- PrintIndexAndValues( myArray );
-}
-
-void PrintIndexAndValues( Array^ myArray )
-{
- for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ )
- Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) );
-}
-
-/*
- This code produces the following output.
-
- The Array instance initially contains the following values:
- [0]: The
- [1]: quick
- [2]: brown
- [3]: fox
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
- After reversing:
- [0]: dog
- [1]: lazy
- [2]: the
- [3]: over
- [4]: jumps
- [5]: fox
- [6]: brown
- [7]: quick
- [8]: The
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp
deleted file mode 100644
index 1f394ab0ee6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-
-//
-using namespace System;
-void PrintIndexAndValues( Array^ myArray );
-void main()
-{
- // Creates and initializes a new Array instance.
- Array^ myArray = Array::CreateInstance( String::typeid, 9 );
- myArray->SetValue( "The", 0 );
- myArray->SetValue( "QUICK", 1 );
- myArray->SetValue( "BROWN", 2 );
- myArray->SetValue( "FOX", 3 );
- myArray->SetValue( "jumps", 4 );
- myArray->SetValue( "over", 5 );
- myArray->SetValue( "the", 6 );
- myArray->SetValue( "lazy", 7 );
- myArray->SetValue( "dog", 8 );
-
- // Displays the values of the Array.
- Console::WriteLine( "The Array instance initially contains the following values:" );
- PrintIndexAndValues( myArray );
-
- // Reverses the sort of the values of the Array.
- Array::Reverse( myArray, 1, 3 );
-
- // Displays the values of the Array.
- Console::WriteLine( "After reversing:" );
- PrintIndexAndValues( myArray );
-}
-
-void PrintIndexAndValues( Array^ myArray )
-{
- for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ )
- Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) );
-}
-
-/*
- This code produces the following output.
-
- The Array instance initially contains the following values:
- [0]: The
- [1]: QUICK
- [2]: BROWN
- [3]: FOX
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
- After reversing:
- [0]: The
- [1]: FOX
- [2]: BROWN
- [3]: QUICK
- [4]: jumps
- [5]: over
- [6]: the
- [7]: lazy
- [8]: dog
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp
deleted file mode 100644
index ecaba9d9d0b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Assembly^ mainAssembly = Assembly::GetExecutingAssembly();
- Console::WriteLine( "The executing assembly is {0}.", mainAssembly );
- array^mods = mainAssembly->GetModules();
- Console::WriteLine( "\tModules in the assembly:" );
- for ( int i = 0; i < mods->Length; i++ )
- Console::WriteLine( "\t{0}", mods[ i ] );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp
deleted file mode 100644
index 2aa6055f25c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-#using
-
-using namespace System;
-
-//
-namespace InteropServices
-{
- [AttributeUsage(AttributeTargets::Method|
- AttributeTargets::Field|
- AttributeTargets::Property)
- ]
- public ref class DispIdAttribute: public Attribute
- {
- public:
- DispIdAttribute( int value )
- {
- // . . .
- }
-
- property int Value
- {
- int get()
- {
- // . . .
- return 0;
- }
- }
- };
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp
deleted file mode 100644
index b9c151ae5a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-using namespace Microsoft::CSharp;
-CodeCompileUnit^ GetCompileUnit()
-{
-
- // Create a compile unit to contain a CodeDOM graph.
- CodeCompileUnit^ cu = gcnew CodeCompileUnit;
-
- // Create a namespace named TestSpace.
- CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" );
-
- // Declare a new type named TestClass.
- CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" );
-
- // Declare a new member string field named TestField.
- CodeMemberField^ cmf = gcnew CodeMemberField( "System.String","TestField" );
-
- // Add the field to the type.
- cd->Members->Add( cmf );
-
- // Declare a new member method named TestMethod.
- CodeMemberMethod^ cm = gcnew CodeMemberMethod;
- cm->Name = "TestMethod";
-
- // Declare a string variable named TestVariable.
- CodeVariableDeclarationStatement^ cvd = gcnew CodeVariableDeclarationStatement( "System.String1","TestVariable" );
- cm->Statements->Add( cvd );
-
- // Cast the TestField reference expression to string and assign it to the TestVariable.
- CodeAssignStatement^ ca = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "TestVariable" ),gcnew CodeCastExpression( "System.String2",gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" ) ) );
-
- // This code can be used to generate the following code in C#:
- // TestVariable = ((string)(this.TestField));
- cm->Statements->Add( ca );
-
- // Add the TestMethod member to the TestClass type.
- cd->Members->Add( cm );
-
- // Add the TestClass type to the namespace.
- cn->Types->Add( cd );
-
- // Add the TestSpace namespace to the compile unit.
- cu->Namespaces->Add( cn );
- return cu;
-}
-
-int main()
-{
-
- // Output some program information using Console.WriteLine.
- Console::WriteLine( "This program compiles a CodeDOM program that incorrectly declares multiple data" );
- Console::WriteLine( "types to demonstrate handling compiler errors programmatically." );
- Console::WriteLine( "" );
-
- // Compile the CodeCompileUnit retrieved from the GetCompileUnit() method.
- //CSharpCodeProvider ^ provider = gcnew Microsoft::CSharp::CSharpCodeProvider;
- CodeDomProvider ^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Initialize a CompilerParameters with the options for compilation.
- array^assemblies = {"System.dll"};
- CompilerParameters^ options = gcnew CompilerParameters( assemblies,"output.exe" );
-
- // Compile the CodeDOM graph and store the results in a CompilerResults.
- CompilerResults^ results = provider->CompileAssemblyFromDom( options, GetCompileUnit() );
-
- // Compilation produces errors. Print out each error.
- Console::WriteLine( "Listing errors from compilation: " );
- Console::WriteLine( "" );
- for ( int i = 0; i < results->Errors->Count; i++ )
- Console::WriteLine( results->Errors[ i ] );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp
deleted file mode 100644
index 494de16ea1c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Globalization;
-void main()
-{
- DateTime dt = DateTime::Now;
- array^format = {L"d",L"D",L"f",L"F",L"g",L"G",L"m",L"r",L"s",L"t",L"T",L"u",L"U",L"y",L"dddd, MMMM dd yyyy",L"ddd, MMM d \"'\"yy",L"dddd, MMMM dd",L"M/yy",L"dd-MM-yy"};
- String^ date;
- for ( int i = 0; i < format->Length; i++ )
- {
- date = dt.ToString( format[ i ], DateTimeFormatInfo::InvariantInfo );
- Console::WriteLine( String::Concat( format[ i ], L" :", date ) );
-
- }
-
- /** Output.
- *
- * d :08/17/2000
- * D :Thursday, August 17, 2000
- * f :Thursday, August 17, 2000 16:32
- * F :Thursday, August 17, 2000 16:32:32
- * g :08/17/2000 16:32
- * G :08/17/2000 16:32:32
- * m :August 17
- * r :Thu, 17 Aug 2000 23:32:32 GMT
- * s :2000-08-17T16:32:32
- * t :16:32
- * T :16:32:32
- * u :2000-08-17 23:32:32Z
- * U :Thursday, August 17, 2000 23:32:32
- * y :August, 2000
- * dddd, MMMM dd yyyy :Thursday, August 17 2000
- * ddd, MMM d "'"yy :Thu, Aug 17 '00
- * dddd, MMMM dd :Thursday, August 17
- * M/yy :8/00
- * dd-MM-yy :17-08-00
- */
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp
deleted file mode 100644
index ec2ce96c984..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-//
-using namespace System;
-delegate String^ myMethodDelegate( // Declares a delegate for a method that takes in an int and returns a String.
-int myInt );
-
-// Defines some methods to which the delegate can point.
-ref class mySampleClass
-{
-public:
-
- // Defines an instance method.
- String^ myStringMethod( int myInt )
- {
- if ( myInt > 0 )
- return ("positive");
-
- if ( myInt < 0 )
- return ("negative");
-
- return ("zero");
- }
-
-
- // Defines a static method.
- static String^ mySignMethod( int myInt )
- {
- if ( myInt > 0 )
- return ("+");
-
- if ( myInt < 0 )
- return ("-");
-
- return ("");
- }
-
-};
-
-int main()
-{
-
- // Creates one delegate for each method. For the instance method, an
- // instance (mySC) must be supplied. For the static method, only the
- // method name is needed.
- mySampleClass^ mySC = gcnew mySampleClass;
- myMethodDelegate^ myD1 = gcnew myMethodDelegate( mySC, &mySampleClass::myStringMethod );
- myMethodDelegate^ myD2 = gcnew myMethodDelegate( mySampleClass::mySignMethod );
-
- // Invokes the delegates.
- Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 5, myD1( 5 ), myD2( 5 ) );
- Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", -3, myD1( -3 ), myD2( -3 ) );
- Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 0, myD1( 0 ), myD2( 0 ) );
-}
-
-/*
-This code produces the following output:
-
-5 is positive; use the sign "+".
--3 is negative; use the sign "-".
-0 is zero; use the sign "".
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp
deleted file mode 100644
index f3f215111a7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-public ref class EnumSample
-{
-public:
- enum class Colors
- {
- Red = 1,
- Blue = 2
- };
-
- static void main()
- {
- Enum ^ myColors = Colors::Red;
- Console::WriteLine( "The value of this instance is '{0}'", myColors );
- }
-
-};
-
-int main()
-{
- EnumSample::main();
-}
-
-/*
-Output.
-The value of this instance is 'Red'.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp
deleted file mode 100644
index 2c4a0747c4a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Security::Permissions;
-
-public ref class Demo
-{
-private:
- // Make three fields:
- // The first field is private.
- String^ m_field;
-
- // The second field is public.
-public:
- String^ Field;
-
- // The third field is public and literal.
- literal String^ FieldC = "String C";
-
- Demo() { m_field = "String A"; Field = "String B"; }
-};
-
-static void DisplayField(Object^ obj, FieldInfo^ f)
-{
- // Display the field name, value, and attributes.
- //
- Console::WriteLine("{0} = \"{1}\"; attributes: {2}",
- f->Name, f->GetValue(obj), f->Attributes);
-};
-
-void main()
-{
- Console::WriteLine ("\nReflection.FieldAttributes");
- Demo^ d = gcnew Demo();
-
- // Get a Type object for Demo, and a FieldInfo for each of
- // the three fields. Use the FieldInfo to display field
- // name, value for the Demo object in d, and attributes.
- //
- Type^ myType = Demo::typeid;
-
- FieldInfo^ fiPrivate = myType->GetField("m_field",
- BindingFlags::NonPublic | BindingFlags::Instance);
- DisplayField(d, fiPrivate);
-
- FieldInfo^ fiPublic = myType->GetField("Field",
- BindingFlags::Public | BindingFlags::Instance);
- DisplayField(d, fiPublic);
-
- FieldInfo^ fiConstant = myType->GetField("FieldC",
- BindingFlags::Public | BindingFlags::Static);
- DisplayField(d, fiConstant);
-}
-
-/* This code example produces the following output:
-
-Reflection.FieldAttributes
-m_field = "String A"; attributes: Private
-Field = "String B"; attributes: Public
-FieldC = "String C"; attributes: Public, Static, Literal, HasDefault
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp
deleted file mode 100644
index d04993ffecd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class TestClass
-{
- // Define a field.
- private:
- String^ field = "private field" ;
-
-// public:
-// Myfield()
-// : field( "private field" )
-// {}
-//
-//
-// property String^ Field
-// {
-// String^ get()
-// {
-// return field;
-// }
-//
-// }
-};
-
-void main()
-{
- TestClass^ cl = gcnew TestClass;
-
- // Get the type and FieldInfo.
- Type^ t = cl->GetType();
- FieldInfo^ fi = t->GetField("field",
- static_cast(BindingFlags::Instance | BindingFlags::NonPublic));
-
- // Get and display the Ftype s ieldType.
- Console::WriteLine("Field Name: {0}.{1}", t->FullName, fi->Name );
- Console::WriteLine("Field Value: '{0}'", fi->GetValue(cl));
- Console::WriteLine("Field Type: {0}", fi->FieldType);
-}
-// The example displays the following output:
-// Field Name: TestClass.field
-// Field Value: 'private field'
-// Field Type: System.String
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp
deleted file mode 100644
index 11c0acbac47..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Example
-{
-public:
- int f_public;
-internal:
- int f_internal;
-protected:
- int f_protected;
-protected public:
- int f_protected_public;
-protected private:
- int f_protected_private;
-};
-
-void main()
-{
- Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly");
- Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n",
- "", "IsPublic", "IsFamily", "IsFamilyAndAssembly");
-
- for each (FieldInfo^ f in Example::typeid->GetFields(
- BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public))
- {
- Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}",
- f->Name,
- f->IsPublic,
- f->IsAssembly,
- f->IsFamily,
- f->IsFamilyOrAssembly,
- f->IsFamilyAndAssembly
- );
- }
-}
-
-/* This code example produces output similar to the following:
-
- IsAssembly IsFamilyOrAssembly
- IsPublic IsFamily IsFamilyAndAssembly
-
-f_public True False False False False
-f_internal False True False False False
-f_protected False False True False False
-f_protected_public False False False True False
-f_protected_private False False False False True
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp
deleted file mode 100644
index e4ab406d1aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-//Make two fields, one public and one read-only.
-public ref class Myfielda
-{
-public:
- String^ field;
- Myfielda()
- : field( "A - public field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- void set( String^ value )
- {
- if ( field != value )
- {
- field = value;
- }
- }
-
- }
-
-};
-
-public ref class Myfieldb
-{
-private:
- String^ const field;
-
-public:
- Myfieldb()
- : field( "B - readonly field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.FieldInfo" );
- Myfielda^ myfielda = gcnew Myfielda;
- Myfieldb^ myfieldb = gcnew Myfieldb;
-
- //Get the Type and FieldInfo.
- Type^ MyTypea = Type::GetType( "Myfielda" );
- FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) );
- Type^ MyTypeb = Type::GetType( "Myfieldb" );
- FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
-
- //Modify the fields.
- //Note that Myfieldb is not modified, as it is
- //read-only (IsInitOnly is True).
- myfielda->field = "A- modified";
-
- //Myfieldb.field = "B- modified";
- //For the first field, get and display the name, field, and IsInitOnly state.
- Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypea->FullName, Myfieldinfoa->GetValue( myfielda ), Myfieldinfoa->IsInitOnly );
-
- //For the second field get and display the name, field, and IsInitOnly state.
- Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypeb->FullName, Myfieldinfob->GetValue( myfieldb ), Myfieldinfob->IsInitOnly );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp
deleted file mode 100644
index 622ef650283..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Make two fields.
-// private
-public ref class Myfielda
-{
-private:
- String^ SomeField;
-
-public:
- Myfielda()
- : SomeField( "private field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return SomeField;
- }
-
- }
-
-};
-
-
-// public
-public ref class Myfieldb
-{
-public:
- String^ SomeField;
- Myfieldb()
- : SomeField( "public field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return SomeField;
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.FieldInfo" );
- Myfielda^ myfielda = gcnew Myfielda;
- Myfieldb^ myfieldb = gcnew Myfieldb;
-
- // Get the Type and FieldInfo.
- Type^ MyTypea = Type::GetType( "Myfielda" );
- FieldInfo^ Myfieldinfoa = MyTypea->GetField( "SomeField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- Type^ MyTypeb = Type::GetType( "Myfieldb" );
- FieldInfo^ Myfieldinfob = MyTypeb->GetField( "SomeField" );
-
- // Get and display the IsPublic and IsPrivate property values.
- Console::Write( "\n{0}.", MyTypea->FullName );
- Console::Write( "{0} - ", Myfieldinfoa->Name );
- Console::Write( "{0}", myfielda->Field );
- Console::Write( "\n IsPublic = {0}", Myfieldinfoa->IsPublic );
- Console::Write( "\n IsPrivate = {0}", Myfieldinfoa->IsPrivate );
- Console::Write( "\n{0}.", MyTypeb->FullName );
- Console::Write( "{0} - ", Myfieldinfob->Name );
- Console::Write( "{0};", myfieldb->Field );
- Console::Write( "\n IsPublic = {0}", Myfieldinfob->IsPublic );
- Console::Write( "\n IsPrivate = {0}", Myfieldinfob->IsPrivate );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp
deleted file mode 100644
index cac0b79e4d2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Make two fields.
-public ref class Myfielda
-{
-private:
- String^ field;
-
-public:
- Myfielda()
- : field( "A private field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- void set( String^ value )
- {
- if ( field != value )
- {
- field = value;
- }
- }
-
- }
-
-};
-
-public ref class Myfieldb
-{
-private:
- static String^ field = "B static field";
-
-public:
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- void set( String^ value )
- {
- if ( field != value )
- {
- field = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.FieldInfo" );
- Myfielda^ myfielda = gcnew Myfielda;
- Myfieldb^ myfieldb = gcnew Myfieldb;
-
- // Get the Type and FieldInfo.
- Type^ MyTypea = Type::GetType( "Myfielda" );
- FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- Type^ MyTypeb = Type::GetType( "Myfieldb" );
- FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Static) );
-
- // For the first field, get and display the name, field, and IsStatic property value.
- Console::Write( "\n{0} - ", MyTypea->FullName );
- Console::Write( "{0}; ", Myfieldinfoa->GetValue( myfielda ) );
- Console::Write( "IsStatic - {0}", Myfieldinfoa->IsStatic );
-
- // For the second field get and display the name, field, and IsStatic property value.
- Console::Write( "\n{0} - ", MyTypeb->FullName );
- Console::Write( "{0}; ", Myfieldinfob->GetValue( myfieldb ) );
- Console::Write( "IsStatic - {0}", Myfieldinfob->IsStatic );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp
deleted file mode 100644
index 0daa04b49b6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Make a field.
-public ref class Myfield
-{
-private:
- String^ field;
-
-public:
- Myfield()
- : field( "a private field" )
- {}
-
-
- property String^ Field
- {
- String^ get()
- {
- return field;
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.FieldInfo" );
- Myfield^ myfield = gcnew Myfield;
-
- // Get the Type and FieldInfo.
- Type^ MyType = Type::GetType( "Myfield" );
- FieldInfo^ Myfieldinfo = MyType->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
-
- // Get and display the MemberType.
- Console::Write( "\n{0}.", MyType->FullName );
- Console::Write( "{0} - ", Myfieldinfo->Name );
- Console::Write( "{0};", myfield->Field );
- MemberTypes Mymembertypes = Myfieldinfo->MemberType;
- Console::Write( "MemberType is a {0}.", Mymembertypes );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp
deleted file mode 100644
index adbeb6fbeac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-
-#define NULL 0
-void main()
-{
- Type^ tDate = Type::GetType( L"System.DateTime" );
- Object^ result = tDate->InvokeMember( L"Now", BindingFlags::GetProperty, nullptr, NULL, gcnew array(0) );
- Console::WriteLine( result->ToString() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp
deleted file mode 100644
index 13ab6a90a87..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-//
-using namespace System;
-
-void main()
-{
- Console::WriteLine("Classic Math.Round in CPP");
- Console::WriteLine(Math::Round(4.4)); // 4
- Console::WriteLine(Math::Round(4.5)); // 4
- Console::WriteLine(Math::Round(4.6)); // 5
- Console::WriteLine(Math::Round(5.5)); // 6
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp
deleted file mode 100644
index e9c1085e6f1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#using
-
-using namespace System;
-
-ref class Sample
-{
-private:
- void Method()
- {
- //
- Math::Round(3.44, 1); //Returns 3.4.
- Math::Round(3.45, 1); //Returns 3.4.
- Math::Round(3.46, 1); //Returns 3.5.
-
- Math::Round(4.34, 1); // Returns 4.3
- Math::Round(4.35, 1); // Returns 4.4
- Math::Round(4.36, 1); // Returns 4.4
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp
deleted file mode 100644
index fca76263e2b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Console::WriteLine( "\nReflection.MemberInfo" );
-
- // Get the Type and MemberInfo.
- Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" );
- array^Mymemberinfoarray = MyType->GetMembers();
-
- // Get the MemberType method and display the elements.
- Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->GetLength( 0 ) );
- Console::Write( "{0}.", MyType->FullName );
- for ( int counter = 0; counter < Mymemberinfoarray->Length; counter++ )
- {
- Console::Write( "\n{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType );
-
- }
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp
deleted file mode 100644
index f4a7d06c3ce..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- // Get the Type and MemberInfo.
- Type^ t = Type::GetType("System.Empty");
- array^ memberArray = t->GetMembers();
-
- // Get and display the type that declares the member.
- Console::WriteLine("There are {0} members in {1}",
- memberArray->Length, t->FullName);
- for each (MemberInfo^ member in memberArray) {
- Console::WriteLine("Member {0} declared by {1}",
- member->Name, member->DeclaringType);
- }
-}
-// The example displays the following output:
-// There are 6 members in System.Empty
-// Member ToString declared by System.Empty
-// Member GetObjectData declared by System.Empty
-// Member Equals declared by System.Object
-// Member GetHashCode declared by System.Object
-// Member GetType declared by System.Object
-// Member Value declared by System.Empty
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp
deleted file mode 100644
index 04e9498bfd7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-int main()
-{
- MemberInfo^ m1 = Object::typeid->GetMethod("ToString");
- MemberInfo^ m2 = MemberInfo::typeid->GetMethod("ToString");
-
- Console::WriteLine("m1.DeclaringType: {0}", m1->DeclaringType);
- Console::WriteLine("m1.ReflectedType: {0}", m1->ReflectedType);
- Console::WriteLine();
- Console::WriteLine("m2.DeclaringType: {0}", m2->DeclaringType);
- Console::WriteLine("m2.ReflectedType: {0}", m2->ReflectedType);
-
- //Console::ReadLine();
-}
-
-/* This code example produces the following output:
-
-m1.DeclaringType: System.Object
-m1.ReflectedType: System.Object
-
-m2.DeclaringType: System.Object
-m2.ReflectedType: System.Reflection.MemberInfo
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp
deleted file mode 100644
index d9f1db69a7b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-
-public ref class AttributesSample
-{
-public:
- void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m )
- {
- *str2m = "in Mymethod";
- }
-};
-
-void PrintAttributes( Type^ attribType, int iAttribValue )
-{
- if ( !attribType->IsEnum )
- {
- Console::WriteLine( "This type is not an enum." );
- return;
- }
-
- array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) );
- for ( int i = 0; i < fields->Length; i++ )
- {
- int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr ));
- if ( (fieldvalue & iAttribValue) == fieldvalue )
- {
- Console::WriteLine( fields[ i ]->Name );
- }
- }
-}
-
-int main()
-{
- Console::WriteLine( "Reflection.MethodBase.Attributes Sample" );
-
- // Get the type of the chosen class.
- Type^ MyType = Type::GetType( "AttributesSample" );
-
- // Get the method Mymethod on the type.
- MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" );
-
- // Display the method name and signature.
- Console::WriteLine( "Mymethodbase = {0}", Mymethodbase );
-
- // Get the MethodAttribute enumerated value.
- MethodAttributes Myattributes = Mymethodbase->Attributes;
-
- // Display the flags that are set.
- PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes );
- return 0;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp
deleted file mode 100644
index b803afb891b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class AttributesSample
-{
-public:
- void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m )
- {
- *str2m = "in Mymethod";
- }
-};
-
-void PrintAttributes( Type^ attribType, int iAttribValue )
-{
- if ( !attribType->IsEnum )
- {
- Console::WriteLine( "This type is not an enum." );
- return;
- }
-
- array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) );
- for ( int i = 0; i < fields->Length; i++ )
- {
- int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr ));
- if ( (fieldvalue & iAttribValue) == fieldvalue )
- {
- Console::WriteLine( fields[ i ]->Name );
- }
- }
-}
-
-int main()
-{
- Console::WriteLine( "Reflection.MethodBase.Attributes Sample" );
-
- // Get the type.
- Type^ MyType = Type::GetType( "AttributesSample" );
-
- // Get the method Mymethod on the type.
- MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" );
-
- // Display the method name.
- Console::WriteLine( "Mymethodbase = {0}", Mymethodbase );
-
- // Get the MethodAttribute enumerated value.
- MethodAttributes Myattributes = Mymethodbase->Attributes;
-
- // Display the flags that are set.
- PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes );
- return 0;
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp
deleted file mode 100644
index 945399096dc..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MagicClass
-{
-private:
- int magicBaseValue;
-
-public:
- MagicClass()
- {
- magicBaseValue = 9;
- }
-
- int ItsMagic(int preMagic)
- {
- return preMagic * magicBaseValue;
- }
-};
-
-public ref class TestMethodInfo
-{
-public:
- static void Main()
- {
- // Get the constructor and create an instance of MagicClass
-
- Type^ magicType = Type::GetType("MagicClass");
- ConstructorInfo^ magicConstructor = magicType->GetConstructor(Type::EmptyTypes);
- Object^ magicClassObject = magicConstructor->Invoke(gcnew array(0));
-
- // Get the ItsMagic method and invoke with a parameter value of 100
-
- MethodInfo^ magicMethod = magicType->GetMethod("ItsMagic");
- Object^ magicValue = magicMethod->Invoke(magicClassObject, gcnew array(1){100});
-
- Console::WriteLine("MethodInfo.Invoke() Example\n");
- Console::WriteLine("MagicClass.ItsMagic() returned: {0}", magicValue);
- }
-};
-
-int main()
-{
- TestMethodInfo::Main();
-}
-
-// The example program gives the following output:
-//
-// MethodInfo.Invoke() Example
-//
-// MagicClass.ItsMagic() returned: 900
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp
deleted file mode 100644
index a8d47e52181..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Console::WriteLine( "\nReflection.MethodBase" );
-
- // Get the types.
- Type^ MyType1 = Type::GetType( "System.Runtime.Serialization.Formatter" );
- Type^ MyType2 = Type::GetType( "System.Reflection.MethodBase" );
-
- // Get and display the methods.
- MethodBase^ Mymethodbase1 = MyType1->GetMethod( "WriteInt32", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- MethodBase^ Mymethodbase2 = MyType2->GetMethod( "GetCurrentMethod", static_cast(BindingFlags::Public | BindingFlags::Static) );
- Console::Write( "\nMymethodbase = {0}", Mymethodbase1 );
- if ( Mymethodbase1->IsAbstract )
- Console::Write( "\nMymethodbase is an abstract method." );
- else
- Console::Write( "\nMymethodbase is not an abstract method." );
-
- Console::Write( "\n\nMymethodbase = {0}", Mymethodbase2 );
- if ( Mymethodbase2->IsAbstract )
- Console::Write( "\nMymethodbase is an abstract method." );
- else
- Console::Write( "\nMymethodbase is not an abstract method." );
-
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp
deleted file mode 100644
index 72f077ad3a4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Example
-{
-public:
- void m_public() {};
-internal:
- void m_internal() {};
-protected:
- void m_protected() {};
-protected public:
- void m_protected_public() {};
-protected private:
- void m_protected_private() {};
-};
-
-void main()
-{
- Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly");
- Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n",
- "", "IsPublic", "IsFamily", "IsFamilyAndAssembly");
-
- for each (MethodBase^ m in Example::typeid->GetMethods(
- BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public))
- {
- if (m->Name->Substring(0, 1) == "m")
- {
- Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}",
- m->Name,
- m->IsPublic,
- m->IsAssembly,
- m->IsFamily,
- m->IsFamilyOrAssembly,
- m->IsFamilyAndAssembly
- );
- }
- }
-}
-
-/* This code example produces output similar to the following:
-
- IsAssembly IsFamilyOrAssembly
- IsPublic IsFamily IsFamilyAndAssembly
-
-m_public True False False False False
-m_internal False True False False False
-m_protected False False True False False
-m_protected_public False False False True False
-m_protected_private False False False False True
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp
deleted file mode 100644
index a7ea8cf252b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Windows::Forms;
-
-//
-int main()
-{
- Console::WriteLine( "\nReflection.MethodBase" );
-
- //Get the MethodBase of a method.
- //Get the type
- Type^ MyType = Type::GetType( "System.MulticastDelegate" );
-
- //Get and display the method
- MethodBase^ Mymethodbase = MyType->GetMethod( "RemoveImpl", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) );
- Console::Write( "\nMymethodbase = {0}", Mymethodbase );
- bool Myispublic = Mymethodbase->IsPublic;
- if ( Myispublic )
- Console::Write( "\nMymethodbase is a public method" );
- else
- Console::Write( "\nMymethodbase is not a public method" );
-
- return 0;
-}
-
-/*
-Produces the following output
-
-Reflection.MethodBase
-Mymethodbase = System.Delegate RemoveImpl (System.Delegate)
-Mymethodbase is not a public method
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp
deleted file mode 100644
index f96f32346d4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyClass
-{
-public:
- void MyMethod(){}
-};
-
-int main()
-{
- MethodBase^ m = MyClass::typeid->GetMethod( "MyMethod" );
- Console::WriteLine( "The IsFinal property value of MyMethod is {0}.", m->IsFinal );
- Console::WriteLine( "The IsVirtual property value of MyMethod is {0}.", m->IsVirtual );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp
deleted file mode 100644
index b878d322184..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Console::WriteLine( "Reflection.MethodInfo" );
-
- // Get the Type and MethodInfo.
- Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" );
- MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" );
- Console::WriteLine( "{0}.{1}", MyType->FullName, Mymethodinfo->Name );
-
- // Get and display the MemberType property.
- MemberTypes Mymembertypes = Mymethodinfo->MemberType;
- if ( MemberTypes::Constructor == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type All." );
- }
- else
- if ( MemberTypes::Custom == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type Custom." );
- }
- else
- if ( MemberTypes::Event == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type Event." );
- }
- else
- if ( MemberTypes::Field == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type Field." );
- }
- else
- if ( MemberTypes::Method == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type Method." );
- }
- else
- if ( MemberTypes::Property == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type Property." );
- }
- else
- if ( MemberTypes::TypeInfo == Mymembertypes )
- {
- Console::WriteLine( "MemberType is of type TypeInfo." );
- }
-
-
-
-
-
-
-
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp
deleted file mode 100644
index 9e122d5e99d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Console::WriteLine( "\nReflection.MethodInfo" );
-
- // Get the Type and MethodInfo.
- Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" );
- MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" );
- Console::Write( "\n{0}.{1}", MyType->FullName, Mymethodinfo->Name );
-
- // Get and display the ReturnType.
- Console::Write( "\nReturnType = {0}", Mymethodinfo->ReturnType );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp
deleted file mode 100644
index 744eed074a9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Runtime::InteropServices;
-
-// First make a method that returns 0.
-// Then swap the method body with a body that returns 1.
-int main()
-{
- // Construct a dynamic assembly
- Guid g = Guid::NewGuid();
- AssemblyName^ asmname = gcnew AssemblyName;
- asmname->Name = String::Concat( "tempfile", g );
- AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()->DefineDynamicAssembly( asmname, AssemblyBuilderAccess::Run );
-
- // Add a dynamic module that contains one type that has one method that
- // has no arguments.
- ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "test" );
- TypeBuilder^ tb = modbuild->DefineType( "name of the Type" );
- array^temp2;
- MethodBuilder^ somemethod = tb->DefineMethod( "My method Name", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp2 );
-
- // Define the body of the method to return 0.
- ILGenerator^ ilg = somemethod->GetILGenerator();
- ilg->Emit( OpCodes::Ldc_I4_0 );
- ilg->Emit( OpCodes::Ret );
-
- // Complete the type and verify that it returns 0.
- Type^ tbBaked = tb->CreateType();
- array^temp0;
- int res1 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp0 ));
- if ( res1 != 0 )
- {
- Console::WriteLine( "Err_001a, should have returned 0" );
- }
- else
- {
- Console::WriteLine( "Original method returned 0" );
- }
-
- // Define a new method body that will return a 1 instead.
-
- // code size
- // ldc_i4_1
- // ret
- array^methodBytes = {0x03,0x30,0x0A,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x2a};
-
- // Get the token for the method whose body you are replacing.
- MethodToken somemethodToken = somemethod->GetToken();
-
- // Get the pointer to the method body.
- GCHandle hmem = GCHandle::Alloc( (Object^)methodBytes, GCHandleType::Pinned );
- IntPtr addr = hmem.AddrOfPinnedObject();
- int cbSize = methodBytes->Length;
-
- // Swap the old method body with the new body.
- MethodRental::SwapMethodBody( tbBaked, somemethodToken.Token, addr, cbSize, MethodRental::JitImmediate );
-
- // Verify that the modified method returns 1.
- array^temp1;
- int res2 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp1 ));
- if ( res2 != 1 )
- {
- Console::WriteLine( "Err_001b, should have returned 1" );
- }
- else
- {
- Console::WriteLine( "Swapped method body returned 1" );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp
deleted file mode 100644
index d2aa22fa155..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ];
- Console::WriteLine( "Module Name is {0}", mod->Name );
- Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName );
- Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName );
-}
-
-/*
-This code produces the following output:
-
-Module Name is modname.exe
-Module FullyQualifiedName is C:\Bin\modname.exe
-Module ScopeName is modname.exe
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp
deleted file mode 100644
index 591da3b46bd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ];
- Console::WriteLine( "Module Name is {0}", mod->Name );
- Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName );
- Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName );
-}
-
-/*
-Produces this output:
-Module Name is modname.exe
-Module FullyQualifiedName is C:\Bin\modname.exe
-Module ScopeName is modname.exe
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp
deleted file mode 100644
index 009ddd456c1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class Sample
-{
-public:
- void Method()
- {
- //
- AssemblyName^ asmname = gcnew AssemblyName;
- asmname->Name = "assemfilename.exe";
- AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()->
- DefineDynamicAssembly( asmname, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "modulename",
- "assemfilename.exe" );
- TypeBuilder^ typebuild1 = modbuild->DefineType( "typename" );
- typebuild1->CreateType();
- asmbuild->Save( "assemfilename.exe" );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp
deleted file mode 100644
index cefa875d170..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class paramatt
-{
-public:
- static void mymethod( String^ str1, [Out]interior_ptr str2, interior_ptr str3 )
- {
- *str2 = "string";
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.ParameterAttributes" );
-
- // Get the Type and the method.
- Type^ Mytype = Type::GetType( "paramatt" );
- MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
-
- // Display the method.
- Console::Write( "\nMymethodbase = {0}", Mymethodbase );
-
- // Get the ParameterInfo array.
- array^Myarray = Mymethodbase->GetParameters();
-
- // Get and display the attributes for the second parameter.
- ParameterAttributes Myparamattributes = Myarray[ 1 ]->Attributes;
- Console::Write( "\nFor the second parameter:\nMyparamattributes = {0}, which is an {1}", (int)Myparamattributes, Myparamattributes );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp
deleted file mode 100644
index 9d1bd81902a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class parminfo
-{
-public:
- static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m )
- {
- *str2m = "in mymethod";
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.Parameterinfo" );
-
- //Get the ParameterInfo parameter of a function.
- //Get the type.
- Type^ Mytype = Type::GetType( "parminfo" );
-
- //Get and display the method.
- MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
- Console::Write( "\nMymethodbase = {0}", Mymethodbase );
-
- //Get the ParameterInfo array.
- array^Myarray = Mymethodbase->GetParameters();
-
- //Get and display the IsOut of each parameter.
- System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- ParameterInfo^ Myparam = safe_cast(enum0->Current);
- Console::Write( "\nFor parameter # {0}, the IsOut is - {1}", Myparam->Position, Myparam->IsOut );
- }
-
- return 0;
-}
-
-/*
-This code produces the following output:
-
-Reflection.ParameterInfo
-
-Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef)
-For parameter # 0, the IsOut is - False
-For parameter # 1, the IsOut is - True
-For parameter # 2, the IsOut is - False
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp
deleted file mode 100644
index f604a9598d8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class parminfo
-{
-public:
- static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m )
- {
- *str2m = "in mymethod";
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.Parameterinfo" );
-
- //Get the ParameterInfo parameter of a function.
- //Get the type.
- Type^ Mytype = Type::GetType( "parminfo" );
-
- //Get and display the method.
- MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
- Console::Write( "\nMymethodbase = {0}", Mymethodbase );
-
- //Get the ParameterInfo array.
- array^Myarray = Mymethodbase->GetParameters();
-
- //Get and display the name of each parameter.
- System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- ParameterInfo^ Myparam = safe_cast(enum0->Current);
- Console::Write( "\nFor parameter # {0}, the Name is - {1}", Myparam->Position, Myparam->Name );
- }
-
- return 0;
-}
-
-/*
-This code produces the following output:
-
-Reflection.ParameterInfo
-
-Mymethodbase
-= Void mymethod (Int32, System.String ByRef, System.String ByRef)
-For parameter # 0, the Name is - int1m
-For parameter # 1, the Name is - str2m
-For parameter # 2, the Name is - str3m
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp
deleted file mode 100644
index e005d0ef83a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::InteropServices;
-public ref class parminfo
-{
-public:
- static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m )
- {
- *str2m = "in mymethod";
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.Parameterinfo" );
-
- //Get the ParameterInfo parameter of a function.
- //Get the type.
- Type^ Mytype = Type::GetType( "parminfo" );
-
- //Get and display the method.
- MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
- Console::Write( "\nMymethodbase = {0}", Mymethodbase );
-
- //Get the ParameterInfo array.
- array^Myarray = Mymethodbase->GetParameters();
-
- //Get and display the ParameterInfo of each parameter.
- System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator();
- while ( enum0->MoveNext() )
- {
- ParameterInfo^ Myparam = safe_cast(enum0->Current);
- Console::Write( "\nFor parameter # {0}, the ParameterType is - {1}", Myparam->Position, Myparam->ParameterType );
- }
-
- return 0;
-}
-
-/*
-This code produces the following output:
-
-Reflection.Parameterinfo
-
-Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef)
-For parameter # 0, the ParameterType is - System.Int32
-For parameter # 1, the ParameterType is - System.String&
-For parameter # 2, the ParameterType is - System.String&
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp
deleted file mode 100644
index 189cd35d9c7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define three properties: one read-write, one default,
-// and one read only.
-// Define a read-write property.
-public ref class Aproperty
-{
-private:
- String^ caption;
-
-public:
- Aproperty()
- : caption( "A Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-
-// Define a default property.
-public ref class Bproperty
-{
-private:
- String^ caption;
-
-public:
- Bproperty()
- : caption( "B Default caption" )
- {}
-
-public:
- property String^ Item
- {
- String^ get()
- {
- return "1";
- }
-
- }
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-
-// Define a read-only property.
-public ref class Cproperty
-{
-private:
- String^ caption;
-
-public:
- Cproperty()
- : caption( "C Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyAttributes" );
-
- // Determine whether a property exists, and change its value.
- Aproperty^ Mypropertya = gcnew Aproperty;
- Bproperty^ Mypropertyb = gcnew Bproperty;
- Cproperty^ Mypropertyc = gcnew Cproperty;
- Console::Write( "\n1. Mypropertya->Caption = {0}", Mypropertya->Caption );
- Console::Write( "\n1. Mypropertyb->Caption = {0}", Mypropertyb->Caption );
- Console::Write( "\n1. Mypropertyc->Caption = {0}", Mypropertyc->Caption );
-
- // Only Mypropertya can be changed, as Mypropertyb is read-only.
- Mypropertya->Caption = "A- This is changed.";
- Mypropertyb->Caption = "B- This is changed.";
-
- // Note that Mypropertyc is not changed because it is read only
- Console::Write( "\n\n2. Mypropertya->Caption = {0}", Mypropertya->Caption );
- Console::Write( "\n2. Mypropertyb->Caption = {0}", Mypropertyb->Caption );
- Console::Write( "\n2. Mypropertyc->Caption = {0}", Mypropertyc->Caption );
-
- // Get the PropertyAttributes enumeration of the property.
- // Get the type.
- Type^ MyTypea = Type::GetType( "Aproperty" );
- Type^ MyTypeb = Type::GetType( "Bproperty" );
- Type^ MyTypec = Type::GetType( "Cproperty" );
-
- // Get the property attributes.
- PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" );
- PropertyAttributes Myattributesa = Mypropertyinfoa->Attributes;
- PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Item" );
- PropertyAttributes Myattributesb = Mypropertyinfob->Attributes;
- PropertyInfo^ Mypropertyinfoc = MyTypec->GetProperty( "Caption" );
- PropertyAttributes Myattributesc = Mypropertyinfoc->Attributes;
-
- // Display the property attributes value.
- Console::Write( "\n\na- {0}", Myattributesa );
- Console::Write( "\nb- {0}", Myattributesb );
- Console::Write( "\nc- {0}", Myattributesc );
- return 0;
-}
-
-// This example displays the following output to the console
-//
-// Reflection.PropertyAttributes
-//
-// 1. Mypropertya.Caption = A Default caption
-// 1. Mypropertyb.Caption = B Default caption
-// 1. Mypropertyc.Caption = C Default caption
-//
-// 2. Mypropertya.Caption = A- This is changed.
-// 2. Mypropertyb.Caption = B- This is changed.
-// 2. Mypropertyc.Caption = C Default caption
-//
-// a- None
-// b- None
-// c- None
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp
deleted file mode 100644
index 5e3598f1d39..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define one readable property and one not readable.
-public ref class Mypropertya
-{
-private:
- String^ caption;
-
-public:
- Mypropertya()
- : caption( "A Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-public ref class Mypropertyb
-{
-private:
- String^ caption;
-
-public:
- Mypropertyb()
- : caption( "B Default caption" )
- {}
-
-
- property String^ Caption
- {
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyInfo" );
-
- // Define two properties.
- Mypropertya^ mypropertya = gcnew Mypropertya;
- Mypropertyb^ mypropertyb = gcnew Mypropertyb;
- Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption );
-
- // Mypropertyb.Caption cannot be read, because
- // there is no get accessor.
- // Get the type and PropertyInfo.
- Type^ MyTypea = Type::GetType( "Mypropertya" );
- PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" );
- Type^ MyTypeb = Type::GetType( "Mypropertyb" );
- PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" );
-
- // Get and display the CanRead property.
- Console::Write( "\nCanRead a - {0}", Mypropertyinfoa->CanRead );
- Console::Write( "\nCanRead b - {0}", Mypropertyinfob->CanRead );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp
deleted file mode 100644
index c83b78e6d61..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define one writable property and one not writable.
-public ref class Mypropertya
-{
-private:
- String^ caption;
-
-public:
- Mypropertya()
- : caption( "A Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-public ref class Mypropertyb
-{
-private:
- String^ caption;
-
-public:
- Mypropertyb()
- : caption( "B Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyInfo" );
-
- // Define two properties.
- Mypropertya^ mypropertya = gcnew Mypropertya;
- Mypropertyb^ mypropertyb = gcnew Mypropertyb;
-
- // Read and display the property.
- Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption );
- Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption );
-
- // Write to the property.
- mypropertya->Caption = "A- No Change";
-
- // Mypropertyb.Caption cannot be written to because
- // there is no set accessor.
- // Read and display the property.
- Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption );
- Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption );
-
- // Get the type and PropertyInfo.
- Type^ MyTypea = Type::GetType( "Mypropertya" );
- PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" );
- Type^ MyTypeb = Type::GetType( "Mypropertyb" );
- PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" );
-
- // Get and display the CanWrite property.
- Console::Write( "\nCanWrite a - {0}", Mypropertyinfoa->CanWrite );
- Console::Write( "\nCanWrite b - {0}", Mypropertyinfob->CanWrite );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp
deleted file mode 100644
index e947e02ff48..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a property.
-public ref class Myproperty
-{
-private:
- String^ caption;
-
-public:
- Myproperty()
- : caption( "A Default caption" )
- {}
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyInfo" );
-
- // Get the type and PropertyInfo for two separate properties.
- Type^ MyTypea = Type::GetType( "Myproperty" );
- PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" );
- Type^ MyTypeb = Type::GetType( "System.Reflection.MethodInfo" );
- PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "MemberType" );
-
- // Get and display the GetGetMethod method for each property.
- MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetGetMethod();
- Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType );
- MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetGetMethod();
- Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType );
-
- // Display the GetGetMethod without using the MethodInfo.
- Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetGetMethod() );
- Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetGetMethod() );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp
deleted file mode 100644
index 6c130b9d45f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// A class that contains some properties.
-public ref class MyProperty
-{
-private:
-
- // Define a simple string property.
- String^ caption;
-
-public:
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-private:
-
- // A very limited indexer that gets or sets one of four
- // strings.
- array^strings;
-
-public:
- MyProperty()
- {
- array^temp0 = {"abc","def","ghi","jkl"};
- strings = temp0;
- }
-
-
- property String^ Item [int]
- {
- String^ get( int Index )
- {
- return strings[ Index ];
- }
-
- void set( int Index, String^ value )
- {
- strings[ Index ] = value;
- }
-
- }
-
-};
-
-int main()
-{
-
- // Get the type and PropertyInfo.
- Type^ t = Type::GetType( "MyProperty" );
- PropertyInfo^ pi = t->GetProperty( "Caption" );
-
- // Get the public GetIndexParameters method.
- array^parms = pi->GetIndexParameters();
- Console::WriteLine( "\n{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) );
-
- // Display a property that has parameters.
- pi = t->GetProperty( "Item" );
- parms = pi->GetIndexParameters();
- Console::WriteLine( "{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) );
- for ( int i = 0; i < parms->GetLength( 0 ); i++ )
- {
- Console::WriteLine( " Parameter: {0}", parms[ i ]->Name );
-
- }
- return 0;
-}
-
-/*
- This example produces the following output:
- MyProperty.Caption has 0 parameters.
- MyProperty.Item has 1 parameters.
- Parameter: Index
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp
deleted file mode 100644
index 490380e255b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a property.
-public ref class Myproperty
-{
-private:
- String^ caption;
-
-public:
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyInfo" );
-
- // Get the type and PropertyInfo for two separate properties.
- Type^ MyTypea = Type::GetType( "Myproperty" );
- PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" );
- Type^ MyTypeb = Type::GetType( "System.Text.StringBuilder" );
- PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Length" );
-
- // Get and display the GetSetMethod method for each property.
- MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetSetMethod();
- Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType );
- MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetSetMethod();
- Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType );
-
- // Display the GetSetMethod without using the MethodInfo.
- Console::Write( "\n\n{0}.{1} GetSetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetSetMethod() );
- Console::Write( "\n{0}.{1} GetSetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetSetMethod() );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp
deleted file mode 100644
index a56525a268e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- Console::WriteLine( "\nReflection.PropertyInfo" );
-
- // Get the type and PropertyInfo.
- Type^ MyType = Type::GetType( "System.Reflection.MemberInfo" );
- PropertyInfo^ Mypropertyinfo = MyType->GetProperty( "Name" );
-
- // Read and display the MemberType property.
- Console::Write( "\nMemberType = {0}", Mypropertyinfo->MemberType );
- return 0;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp
deleted file mode 100644
index 7c87302d269..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-// Define a property.
-public ref class TestClass
-{
-private:
- String^ caption;
-
-public:
- TestClass()
- {
- caption = "A Default caption";
- }
-
-
- property String^ Caption
- {
- String^ get()
- {
- return caption;
- }
-
- void set( String^ value )
- {
- if ( caption != value )
- {
- caption = value;
- }
- }
-
- }
-
-};
-
-int main()
-{
- TestClass^ t = gcnew TestClass;
-
- // Get the type and PropertyInfo.
- Type^ myType = t->GetType();
- PropertyInfo^ pinfo = myType->GetProperty( "Caption" );
-
- // Display the property value, using the GetValue method.
- Console::WriteLine( "\nGetValue: {0}", pinfo->GetValue( t, nullptr ) );
-
- // Use the SetValue method to change the caption.
- pinfo->SetValue( t, "This caption has been changed.", nullptr );
-
- // Display the caption again.
- Console::WriteLine( "GetValue: {0}", pinfo->GetValue( t, nullptr ) );
- Console::WriteLine( "\nPress the Enter key to continue." );
- Console::ReadLine();
- return 0;
-}
-
-/*
-This example produces the following output:
-
-GetValue: A Default caption
-GetValue: This caption has been changed
-
-Press the Enter key to continue.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp
deleted file mode 100644
index bdf0c7f6486..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-
-void main()
-{
- Random^ rnd = gcnew Random;
- array^b = gcnew array(10);
- rnd->NextBytes( b );
- Console::WriteLine("The Random bytes are:");
- for ( int i = 0; i < 10; i++ )
- Console::WriteLine("{0}: {1}", i, b[i]);
-}
-// The example displays output similar to the following:
-// The Random bytes are:
-// 0: 131
-// 1: 96
-// 2: 226
-// 3: 213
-// 4: 176
-// 5: 208
-// 6: 99
-// 7: 89
-// 8: 226
-// 9: 194
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp
deleted file mode 100644
index 7c44cb174ba..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#using
-
-using namespace System;
-
-ref class Sample
-{
-private:
- void Method()
- {
- //
- String^ str = "BBQ and Slaw";
- Console::WriteLine( str->PadLeft( 15 ) ); // Displays " BBQ and Slaw".
- Console::WriteLine( str->PadLeft( 5 ) ); // Displays "BBQ and Slaw".
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp
deleted file mode 100644
index 4f65f5fcc67..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#using
-
-//
-using namespace System;
-
-void main()
-{
- String^ str = "forty-two";
- Console::WriteLine( str->PadLeft( 15, L'.' ) );
- Console::WriteLine( str->PadLeft( 2, L'.' ) );
-}
-// The example displays the following output:
-// ......forty-two
-// forty-two
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp
deleted file mode 100644
index d313d14119e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#using
-
-using namespace System;
-ref class Sample
-{
-private:
- void Method()
- {
-
- //
- String^ str = "BBQ and Slaw";
- Console::Write( "|" );
- Console::Write( str->PadRight( 15 ) );
- Console::WriteLine( "|" ); // Displays "|BBQ and Slaw |".
- Console::Write( "|" );
- Console::Write( str->PadRight( 5 ) );
- Console::WriteLine( "|" ); // Displays "|BBQ and Slaw|".
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp
deleted file mode 100644
index 0786d97857d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#using
-
-using namespace System;
-ref class Sample
-{
-private:
- void Method()
- {
- //
- String^ str = "forty-two";
- Console::Write( "|" );
- Console::Write( str->PadRight( 15, '.' ) );
- Console::WriteLine( "|" ); // Displays "|forty-two......|".
- Console::Write( "|" );
- Console::Write( str->PadRight( 5, '.' ) );
- Console::WriteLine( "|" ); // Displays "|forty-two|".
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp
deleted file mode 100644
index 16e8d85658e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class dtype abstract
-{
-public:
- ref class MyClassA abstract
- {
- public:
- virtual int m() = 0;
- };
-
- ref class MyClassB abstract: public MyClassA{};
-};
-
-int main()
-{
- Console::WriteLine( "The declaring type of m is {0}.", dtype::MyClassB::typeid->GetMethod( "m" )->DeclaringType );
-}
-/* The example produces the following output:
-
-The declaring type of m is dtype+MyClassA.
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp
deleted file mode 100644
index ee3ada47aea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-using namespace System;
-using namespace System::IO;
-using namespace System::Reflection;
-
-public ref class Sample
-{
-public:
- void Method( Type^ type )
- {
- ConstructorInfo^ cInfo;
-
- //
- cInfo = type->GetConstructor( BindingFlags::ExactBinding, nullptr,
- Type::EmptyTypes, nullptr );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp
deleted file mode 100644
index eaae896f09f..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-
-// Class added so sample will compile
-public ref class Application
-{
-public:
- void Method(){}
-};
-
-public ref class Sample
-{
-public:
- void Method()
- {
- //
- // Get the set of methods associated with the type
- array^ mi = Application::typeid->FindMembers(
- (MemberTypes)(MemberTypes::Constructor | MemberTypes::Method),
- (BindingFlags)(BindingFlags::Public | BindingFlags::Static |
- BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly),
- Type::FilterName, "*" );
- Console::WriteLine( "Number of methods (includes constructors): {0}", mi->Length );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp
deleted file mode 100644
index 4c9e6c12c06..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class t
-{
-public:
- t(){}
-
- static t(){}
-
- t( int /*i*/ ){}
-
-};
-
-int main()
-{
- array^p = t::typeid->GetConstructors();
- Console::WriteLine( p->Length );
- for ( int i = 0; i < p->Length; i++ )
- {
- Console::WriteLine( p[ i ]->IsStatic );
-
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp
deleted file mode 100644
index 881b9216d30..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-public ref class t
-{
-public:
- t(){}
-
- t( int /*i*/ ){}
-
- static t(){}
-
-};
-
-int main()
-{
- array^p = t::typeid->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::NonPublic | BindingFlags::Instance) );
- Console::WriteLine( p->Length );
- for ( int i = 0; i < p->Length; i++ )
- {
- Console::WriteLine( p[ i ]->IsStatic );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp
deleted file mode 100644
index f0af5fbd409..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Reflection;
-
-int main()
-{
- //Get the Type and MemberInfo.
- Type^ t = Type::GetType("System.IO.File");
- array^ members = t->GetMembers();
-
- //Get and display the DeclaringType method.
- Console::WriteLine("There are {0} members in {1}.",
- members->Length, t->FullName );
- Console::WriteLine("Is {0} non-public? {1}",
- t->FullName, t->IsNotPublic );
-}
-// The example displays the following output:
-// There are 60 members in System.IO.File.
-// Is System.IO.File non-public? False
-//
-
-//
-public ref class A
-{
-public:
- ref class B{};
-
-
-private:
- ref class C{};
-
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp
deleted file mode 100644
index 47d546e7a06..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Reflection;
-using namespace System::Text;
-public ref class Sample
-{
-protected:
- bool ShowMethods;
- StreamWriter^ myWriter;
-
-private:
- void DumpMethods( Type^ aType )
- {
- if ( !ShowMethods )
- return;
-
- array^mInfo = aType->GetMethods();
- myWriter->WriteLine( "Methods" );
- bool found = false;
- if ( mInfo->Length != 0 )
- {
- for ( int i = 0; i < mInfo->Length; i++ )
- {
-
- // Only display methods declared in this type. Also
- // filter out any methods with special names, because these
- // cannot be generally called by the user. That is, their
- // functionality is usually exposed in other ways, for example,
- // property get/set methods are exposed as properties.
- if ( mInfo[ i ]->DeclaringType == aType && !mInfo[ i ]->IsSpecialName )
- {
- found = true;
- StringBuilder^ modifiers = gcnew StringBuilder;
- if ( mInfo[ i ]->IsStatic )
- {
- modifiers->Append( "static " );
- }
- if ( mInfo[ i ]->IsPublic )
- {
- modifiers->Append( "public " );
- }
- if ( mInfo[ i ]->IsFamily )
- {
- modifiers->Append( "protected " );
- }
- if ( mInfo[ i ]->IsAssembly )
- {
- modifiers->Append( "internal " );
- }
- if ( mInfo[ i ]->IsPrivate )
- {
- modifiers->Append( "private " );
- }
- myWriter->WriteLine( "{0} {1}", modifiers, mInfo[ i ] );
- }
-
- }
- }
-
- if ( !found )
- {
- myWriter->WriteLine( "(none)" );
- }
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp
deleted file mode 100644
index 5f55897e971..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Sample
-{
-public:
- void Method( Type^ t, MemberInfo^ mi )
- {
- //
- array^ others = t->GetMember( mi->Name, mi->MemberType,
- (BindingFlags)(BindingFlags::Public | BindingFlags::Static |
- BindingFlags::NonPublic | BindingFlags::Instance) );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp
deleted file mode 100644
index be2838788b7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::CodeDom::Compiler;
-
-ref class Example
-{
-public:
- static void Main()
- {
- // VB source for example. Not all versions of CS and CPP compilers
- // support optional arguments.
- String^ codeLines =
- "Imports System\n\n" +
- "Public Class OptionalArg\n" +
- " Public Sub MyMethod(ByVal a As Integer, _\n" +
- " Optional ByVal b As Double = 1.2, _\n" +
- " Optional ByVal c As Integer = 1)\n\n" +
- " Console.WriteLine(\"a = \" & a & \" b = \" & b & \" c = \" & c)\n" +
- " End Sub\n" +
- "End Class\n";
-
- // Generate a OptionalArg instance from the source above.
- Object^ o = GenerateObjectFromSource("OptionalArg", codeLines, "VisualBasic");
- Type^ t;
-
- t = o->GetType();
- BindingFlags bf = BindingFlags::Public | BindingFlags::Instance |
- BindingFlags::InvokeMethod | BindingFlags::OptionalParamBinding;
-
- t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 55.3, 12});
- t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 1.3, Type::Missing});
- t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, Type::Missing, Type::Missing});
- }
-
-private:
- static Object^ GenerateObjectFromSource(String^ objectName,
- String^ sourceLines, String^ providerName)
- {
- Object^ genObject = nullptr;
- CodeDomProvider^ codeProvider = CodeDomProvider::CreateProvider(providerName);
- CompilerParameters^ cp = gcnew CompilerParameters();
-
- cp->GenerateExecutable = false;
- cp->GenerateInMemory = true;
-
- CompilerResults^ results =
- codeProvider->CompileAssemblyFromSource(cp, sourceLines);
- if (results->Errors->Count == 0)
- {
- genObject = results->CompiledAssembly->CreateInstance(objectName);
- }
-
- return genObject;
- }
-};
-
-int main()
-{
- Example::Main();
-}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp
deleted file mode 100644
index e40dfeced46..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class MyClassA abstract
-{
-public:
- ref class MyClassB abstract
- {
-
- };
-
-};
-
-int main()
-{
- Console::WriteLine( "Reflected type of MyClassB is {0}", MyClassA::MyClassB::typeid->ReflectedType );
- //Outputs MyClassA, the enclosing type.
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp
deleted file mode 100644
index d0cc8fad02a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- // Get the type of a chosen class.
- Type^ t = ReflectionTypeLoadException::typeid;
-
- // Get the MemberInfo array.
- array^ members = t->GetMembers();
-
- // Get and display the name and the MemberType for each member.
- Console::WriteLine("Members of {0}", t->Name);
- for each (MemberInfo^ member in members) {
- MemberTypes memberType = member->MemberType;
- Console::WriteLine(" {0}: {1}", member->Name, memberType);
- }
-}
-// The example displays the following output:
-// Members of ReflectionTypeLoadException
-// get_Types: Method
-// get_LoaderExceptions: Method
-// GetObjectData: Method
-// get_Message: Method
-// get_Data: Method
-// GetBaseException: Method
-// get_InnerException: Method
-// get_TargetSite: Method
-// get_StackTrace: Method
-// get_HelpLink: Method
-// set_HelpLink: Method
-// get_Source: Method
-// set_Source: Method
-// ToString: Method
-// get_HResult: Method
-// GetType: Method
-// Equals: Method
-// GetHashCode: Method
-// GetType: Method
-// .ctor: Constructor
-// .ctor: Constructor
-// Types: Property
-// LoaderExceptions: Property
-// Message: Property
-// Data: Property
-// InnerException: Property
-// TargetSite: Property
-// StackTrace: Property
-// HelpLink: Property
-// Source: Property
-// HResult: Property
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp
deleted file mode 100644
index 3caae363b62..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// Equals.cpp : Defines the entry point for the console application.
-//
-
-//#include "stdafx.h"
-
-//
-#using
-
-using namespace System;
-using namespace System::Numerics;
-
-void main()
-{
- BigInteger bigIntValue;
-
- Byte byteValue = 16;
- bigIntValue = BigInteger(byteValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- byteValue.GetType()->Name, byteValue,
- bigIntValue.Equals((Int64)byteValue));
-
- SByte sbyteValue = -16;
- bigIntValue = BigInteger(sbyteValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- sbyteValue.GetType()->Name, sbyteValue,
- bigIntValue.Equals((Int64)sbyteValue));
-
- Int16 shortValue = 1233;
- bigIntValue = BigInteger(shortValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- shortValue.GetType()->Name, shortValue,
- bigIntValue.Equals((Int64)shortValue));
-
- UInt16 ushortValue = 64000;
- bigIntValue = BigInteger(ushortValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- ushortValue.GetType()->Name, ushortValue,
- bigIntValue.Equals((Int64)ushortValue));
-
- int intValue = -1603854;
- bigIntValue = BigInteger(intValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- intValue.GetType()->Name, intValue,
- bigIntValue.Equals((Int64)intValue));
-
- UInt32 uintValue = 1223300;
- bigIntValue = BigInteger(uintValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- uintValue.GetType()->Name, uintValue,
- bigIntValue.Equals((Int64)uintValue));
-
- Int64 longValue = -123822229012;
- bigIntValue = BigInteger(longValue);
- Console::WriteLine("{0} {1} = {2} {3} : {4}",
- bigIntValue.GetType()->Name, bigIntValue,
- longValue.GetType()->Name, longValue,
- bigIntValue.Equals((Int64)longValue));
-}
-/*
-The example displays output like the following:
- BigInteger 16 = Byte 16 : True
- BigInteger -16 = SByte -16 : True
- BigInteger 1233 = Int16 1233 : True
- BigInteger 64000 = UInt16 64000 : True
- BigInteger -1603854 = Int32 -1603854 : True
- BigInteger 1223300 = UInt32 1223300 : True
- BigInteger -123822229012 = Int64 -123822229012 : True
-*/
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp
deleted file mode 100644
index c480f604daa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Equals2.cpp : Defines the entry point for the console application.
-//
-
-//
-#using
-
-using namespace System;
-using namespace System::Numerics;
-
-
-void main()
-{
- const Int64 LIGHT_YEAR = 5878625373183;
-
- BigInteger altairDistance = 17 * LIGHT_YEAR;
- BigInteger epsilonIndiDistance = 12 * LIGHT_YEAR;
- BigInteger ursaeMajoris47Distance = 46 * LIGHT_YEAR;
- Int64 tauCetiDistance = 12 * LIGHT_YEAR;
- UInt64 procyon2Distance = 12 * LIGHT_YEAR;
- Object^ wolf424ABDistance = 14 * LIGHT_YEAR;
-
- Console::WriteLine("Approx. equal distances from Epsilon Indi to:");
- Console::WriteLine(" Altair: {0}",
- epsilonIndiDistance.Equals(altairDistance));
- Console::WriteLine(" Ursae Majoris 47: {0}",
- epsilonIndiDistance.Equals(ursaeMajoris47Distance));
- Console::WriteLine(" TauCeti: {0}",
- epsilonIndiDistance.Equals(tauCetiDistance));
- Console::WriteLine(" Procyon 2: {0}",
- epsilonIndiDistance.Equals(procyon2Distance));
- Console::WriteLine(" Wolf 424 AB: {0}",
- epsilonIndiDistance.Equals(wolf424ABDistance));
-}
-/*
-The example displays output like the following:
- Approx. equal distances from Epsilon Indi to:
- Altair: False
- Ursae Majoris 47: False
- TauCeti: True
- Procyon 2: True
- Wolf 424 AB: False
-*/
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp
deleted file mode 100644
index 44abeeae6c3..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-class MethodBodyDemo
-{
-public:
-
- // This class will demonstrate how to create a method body using
- // the MethodBuilder::CreateMethodBody(Byte[], int) method.
- static Type^ BuildDynType()
- {
- Type^ addType = nullptr;
- AppDomain^ currentDom = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
-
- // The dynamic assembly space has been created. Next, create a module
- // within it. The type Point will be reflected into this module.
- ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( "MyModule" );
- TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Adder" );
- array^temp0 = {int::typeid,int::typeid};
- MethodBuilder^ myMthdBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp0 );
-
- // Build the array of Bytes holding the MSIL instructions.
-
- /* 02h is the opcode for ldarg.0 */
- /* 03h is the opcode for ldarg.1 */
- /* 58h is the opcode for add */
- /* 2Ah is the opcode for ret */
- array^temp1 = {0x02,0x03,0x58,0x2A};
- array^ILcodes = temp1;
- myMthdBldr->CreateMethodBody( ILcodes, ILcodes->Length );
- addType = myTypeBldr->CreateType();
- return addType;
- }
-
-};
-
-int main()
-{
- Type^ myType = MethodBodyDemo::BuildDynType();
- Console::WriteLine( "---" );
- Console::Write( "Enter the first integer to add: " );
- int aVal = Convert::ToInt32( Console::ReadLine() );
- Console::Write( "Enter the second integer to add: " );
- int bVal = Convert::ToInt32( Console::ReadLine() );
- Object^ adderInst = Activator::CreateInstance( myType, gcnew array(0) );
- array^temp1 = {aVal,bVal};
- Console::WriteLine( "The value of adding {0} to {1} is: {2}.", aVal, bVal, myType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, adderInst, temp1 ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp
deleted file mode 100644
index bd325cd3b40..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- // Get a Type object.
- Type^ t = int::typeid;
- // Instantiate an Assembly class to the assembly housing the Integer type.
- Assembly^ assem = Assembly::GetAssembly(t);
- // Display the name of the assembly.
- Console::WriteLine("Name: {0}", assem->FullName);
- // Get the location of the assembly using the file: protocol.
- Console::WriteLine("CodeBase: {0}", assem->CodeBase);
-}
-// The example displays output like the following:
-// Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-// CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp
deleted file mode 100644
index 21eed0e53a5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-
-void Snippet1()
-{
- Assembly^ SampleAssembly;
- // Instantiate a target object.
- Int32 Integer1(0);
- Type^ Type1;
- // Set the Type instance to the target class type.
- Type1 = Integer1.GetType();
- // Instantiate an Assembly class to the assembly housing the Integer type.
- SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
- // Gets the location of the assembly using file: protocol.
- Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase );
-}
-void Snippet2()
-{
- //
- Assembly^ SampleAssembly;
- // Instantiate a target object.
- Int32 Integer1(0);
- Type^ Type1;
- // Set the Type instance to the target class type.
- Type1 = Integer1.GetType();
- // Instantiate an Assembly class to the assembly housing the Integer type.
- SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
- // Write the display name of assembly including base name and version.
- Console::WriteLine( "FullName= {0}", SampleAssembly->FullName );
- // The example displays the following output:
- // FullName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- //
-}
-void Snippet3()
-{
- //
- Assembly^ SampleAssembly;
- // Instantiate a target object.
- Int32 Integer1(0);
- Type^ Type1;
- // Set the Type instance to the target class type.
- Type1 = Integer1.GetType();
- // Instantiate an Assembly class to the assembly housing the Integer type.
- SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
- // Display the physical location of the assembly containing the manifest.
- Console::WriteLine( "Location= {0}", SampleAssembly->Location );
- // The example displays the following output:
- // Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
- //
-}
-
-void Snippet5()
-{
- //
- Assembly^ SampleAssembly;
- // Instantiate a target object.
- Int32 Integer1(0);
- Type^ Type1;
- // Set the Type instance to the target class type.
- Type1 = Integer1.GetType();
- // Instantiate an Assembly class to the assembly housing the Integer type.
- SampleAssembly = Assembly::GetAssembly( Integer1.GetType() );
- // Display the name of the assembly currently executing
- Console::WriteLine( "GetExecutingAssembly= {0}", Assembly::GetExecutingAssembly()->FullName );
- // The example displays the following output:
- // GetExecutingAssembly=assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- //
-}
-void Snippet6()
-{
- //
- Assembly^ SampleAssembly;
- // Load the assembly by providing the location of the assembly file.
- SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" );
- for each ( Type^ ExportedType in SampleAssembly->GetExportedTypes() )
- {
- Console::WriteLine( ExportedType );
- }
- //
-}
-void Snippet7()
-{
- //
- Assembly^ SampleAssembly;
- // Load the assembly by providing the type name.
- SampleAssembly = Assembly::Load( "MyAssembly" );
- for each ( String^ Resource in SampleAssembly->GetManifestResourceNames() )
- {
- Console::WriteLine( Resource );
- }
- //
-}
-void Snippet8()
-{
- //
- Assembly^ SampleAssembly;
- SampleAssembly = Assembly::Load( "System.Data" );
- array^ Types = SampleAssembly->GetTypes();
- for each ( Type^ oType in Types )
- {
- Console::WriteLine( oType->Name );
- }
- //
-}
-void Snippet9()
-{
- //
- Assembly^ SampleAssembly;
- SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" );
-
- // Obtain a reference to the first class contained in the assembly.
- Type^ oType = SampleAssembly->GetTypes()[ 0 ];
- // Obtain a reference to the public properties of the type.
- array^ Props = oType->GetProperties();
- // Display information about public properties of assembly type.
- // Prop = Prop1
- // DeclaringType = Sample::Assembly.Class1
- // Type = System::String
- // Readable = True
- // Writable = False
- for each ( PropertyInfo^ Prop in Props )
- {
- Console::WriteLine( "Prop= {0}", Prop->Name );
- Console::WriteLine( " DeclaringType= {0}", Prop->DeclaringType );
- Console::WriteLine( " Type= {0}", Prop->PropertyType );
- Console::WriteLine( " Readable= {0}", Prop->CanRead );
- Console::WriteLine( " Writable= {0}", Prop->CanWrite );
- }
- //
-}
-void Snippet10()
-{
- //
- Assembly^ SampleAssembly;
- SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" );
- array^ Methods = SampleAssembly->GetTypes()[ 0 ]->GetMethods();
- // Obtain a reference to the method members
- for each ( MethodInfo^ Method in Methods )
- {
- Console::WriteLine( "Method Name= {0}", Method->Name );
- }
- //
-}
-void Snippet11()
-{
- //
- Assembly^ SampleAssembly;
- SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" );
- // Obtain a reference to a method known to exist in assembly.
- MethodInfo^ Method = SampleAssembly->GetTypes()[ 0 ]->GetMethod( "Method1" );
- // Obtain a reference to the parameters collection of the MethodInfo instance.
- array^ Params = Method->GetParameters();
- // Display information about method parameters.
- // Param = sParam1
- // Type = System::String
- // Position = 0
- // Optional=False
- for each ( ParameterInfo^ Param in Params )
- {
- Console::WriteLine( "Param= {0}", Param->Name );
- Console::WriteLine( " Type= {0}", Param->ParameterType );
- Console::WriteLine( " Position= {0}", Param->Position );
- Console::WriteLine( " Optional= {0}", Param->IsOptional );
- }
- //
- Console::ReadLine();
-}
-
-void main()
-{
- Snippet1();
- Snippet2();
- Snippet3();
- Snippet5();
- Snippet6();
- Snippet7();
- Snippet8();
- Snippet9();
- Snippet10();
- Snippet11();
-}
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp
deleted file mode 100644
index 3c54fa6e1c5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- // Instantiate a target object.
- int integer1 = 1632;
- // Instantiate an Assembly class to the assembly housing the Integer type.
- Assembly^ systemAssembly = integer1.GetType()->Assembly;
- // Get the location of the assembly using the file: protocol.
- Console::WriteLine("CodeBase = {0}", systemAssembly->CodeBase);
-}
-// The example displays output like the following:
-// CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp
deleted file mode 100644
index a109f1df474..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-void main()
-{
- // Instantiate a target object.
- Int32 integer1 = 0;
- // Set the Type instance to the target class type.
- Type^ type1 = integer1.GetType();
- // Instantiate an Assembly class to the assembly housing the Integer type.
- Assembly^ sampleAssembly = Assembly::GetAssembly(integer1.GetType());
- // Display the name of the assembly that is calling the method.
- Console::WriteLine("GetCallingAssembly = {0}", Assembly::GetCallingAssembly()->FullName);
-}
-// The example displays output like the following:
-// GetCallingAssembly = Example, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp
deleted file mode 100644
index ba2e35bfbb6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ DynamicDotProductGen()
-{
- Type^ ivType = nullptr;
- array^temp0 = {int::typeid,int::typeid,int::typeid};
- array^ctorParams = temp0;
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "IntVectorAsm";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ IntVectorModule = myAsmBuilder->DefineDynamicModule( "IntVectorModule", "Vector.dll" );
- TypeBuilder^ ivTypeBld = IntVectorModule->DefineType( "IntVector", TypeAttributes::Public );
- FieldBuilder^ xField = ivTypeBld->DefineField( "x", int::typeid, FieldAttributes::Private );
- FieldBuilder^ yField = ivTypeBld->DefineField( "y", int::typeid, FieldAttributes::Private );
- FieldBuilder^ zField = ivTypeBld->DefineField( "z", int::typeid, FieldAttributes::Private );
- Type^ objType = Type::GetType( "System.Object" );
- ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) );
- ConstructorBuilder^ ivCtor = ivTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams );
- ILGenerator^ ctorIL = ivCtor->GetILGenerator();
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Call, objCtor );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_1 );
- ctorIL->Emit( OpCodes::Stfld, xField );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_2 );
- ctorIL->Emit( OpCodes::Stfld, yField );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_3 );
- ctorIL->Emit( OpCodes::Stfld, zField );
- ctorIL->Emit( OpCodes::Ret );
-
- // This method will find the dot product of the stored vector
- // with another.
- array^temp1 = {ivTypeBld};
- array^dpParams = temp1;
-
- // Here, you create a MethodBuilder containing the
- // name, the attributes (public, static, private, and so on),
- // the return type (int, in this case), and a array of Type
- // indicating the type of each parameter. Since the sole parameter
- // is a IntVector, the very class you're creating, you will
- // pass in the TypeBuilder (which is derived from Type) instead of
- // a Type object for IntVector, avoiding an exception.
- // -- This method would be declared in C# as:
- // public int DotProduct(IntVector aVector)
- MethodBuilder^ dotProductMthd = ivTypeBld->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, dpParams );
-
- // A ILGenerator can now be spawned, attached to the MethodBuilder.
- ILGenerator^ mthdIL = dotProductMthd->GetILGenerator();
-
- // Here's the body of our function, in MSIL form. We're going to find the
- // "dot product" of the current vector instance with the passed vector
- // instance. For reference purposes, the equation is:
- // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product
- // First, you'll load the reference to the current instance "this"
- // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent
- // instruction, will pop the reference off the stack and look up the
- // field "x", specified by the FieldInfo token "xField".
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldfld, xField );
-
- // That completed, the value stored at field "x" is now atop the stack.
- // Now, you'll do the same for the Object reference we passed as a
- // parameter, stored in argument 1 (ldarg.1). After Ldfld executed,
- // you'll have the value stored in field "x" for the passed instance
- // atop the stack.
- mthdIL->Emit( OpCodes::Ldarg_1 );
- mthdIL->Emit( OpCodes::Ldfld, xField );
-
- // There will now be two values atop the stack - the "x" value for the
- // current vector instance, and the "x" value for the passed instance.
- // You'll now multiply them, and push the result onto the evaluation stack.
- mthdIL->Emit( OpCodes::Mul_Ovf_Un );
-
- // Now, repeat this for the "y" fields of both vectors.
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldfld, yField );
- mthdIL->Emit( OpCodes::Ldarg_1 );
- mthdIL->Emit( OpCodes::Ldfld, yField );
- mthdIL->Emit( OpCodes::Mul_Ovf_Un );
-
- // At this time, the results of both multiplications should be atop
- // the stack. You'll now add them and push the result onto the stack.
- mthdIL->Emit( OpCodes::Add_Ovf_Un );
-
- // Multiply both "z" field and push the result onto the stack.
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldfld, zField );
- mthdIL->Emit( OpCodes::Ldarg_1 );
- mthdIL->Emit( OpCodes::Ldfld, zField );
- mthdIL->Emit( OpCodes::Mul_Ovf_Un );
-
- // Finally, add the result of multiplying the "z" fields with the
- // result of the earlier addition, and push the result - the dot product -
- // onto the stack.
- mthdIL->Emit( OpCodes::Add_Ovf_Un );
-
- // The "ret" opcode will pop the last value from the stack and return it
- // to the calling method. You're all done!
- mthdIL->Emit( OpCodes::Ret );
- ivType = ivTypeBld->CreateType();
- return ivType;
-}
-
-int main()
-{
- Type^ IVType = nullptr;
- Object^ aVector1 = nullptr;
- Object^ aVector2 = nullptr;
- array^temp2 = {int::typeid,int::typeid,int::typeid};
- array^aVtypes = temp2;
- array^temp3 = {10,10,10};
- array^aVargs1 = temp3;
- array^temp4 = {20,20,20};
- array^aVargs2 = temp4;
-
- // Call the method to build our dynamic class.
- IVType = DynamicDotProductGen();
- Console::WriteLine( "---" );
- ConstructorInfo^ myDTctor = IVType->GetConstructor( aVtypes );
- aVector1 = myDTctor->Invoke( aVargs1 );
- aVector2 = myDTctor->Invoke( aVargs2 );
- array^passMe = gcnew array(1);
- passMe[ 0 ] = dynamic_cast(aVector2);
- Console::WriteLine( "(10, 10, 10) . (20, 20, 20) = {0}", IVType->InvokeMember( "DotProduct", BindingFlags::InvokeMethod, nullptr, aVector1, passMe ) );
-}
-
-// +++ OUTPUT +++
-// ---
-// (10, 10, 10) . (20, 20, 20) = 600
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp
deleted file mode 100644
index 210c6ee6489..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-
-//
-using namespace System;
-using namespace System::IO;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-ref class AsmBuilderGetFileDemo
-{
-public:
- static String^ myResourceFileName = "MyResource.txt";
- static FileInfo^ CreateResourceFile()
- {
- FileInfo^ f = gcnew FileInfo( myResourceFileName );
- StreamWriter^ sw = f->CreateText();
- sw->WriteLine( "Hello, world!" );
- sw->Close();
- return f;
- }
-
- static AssemblyBuilder^ BuildDynAssembly()
- {
- String^ myAsmFileName = "MyAsm.dll";
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
- myAsmBuilder->AddResourceFile( "MyResource", myResourceFileName );
-
- // To confirm that the resource file has been added to the manifest,
- // we will save the assembly as MyAsm.dll. You can view the manifest
- // and confirm the presence of the resource file by running
- // "ildasm MyAsm.dll" from the prompt in the directory where you executed
- // the compiled code.
- myAsmBuilder->Save( myAsmFileName );
- return myAsmBuilder;
- }
-
-};
-
-int main()
-{
- FileStream^ myResourceFS = nullptr;
- AsmBuilderGetFileDemo::CreateResourceFile();
- Console::WriteLine( "The contents of MyResource.txt, via GetFile:" );
- AssemblyBuilder^ myAsm = AsmBuilderGetFileDemo::BuildDynAssembly();
- try
- {
- myResourceFS = myAsm->GetFile( AsmBuilderGetFileDemo::myResourceFileName );
- }
- catch ( NotSupportedException^ )
- {
- Console::WriteLine( "---" );
- Console::WriteLine( "System::Reflection::Emit::AssemblyBuilder::GetFile\nis not supported in this SDK build." );
- Console::WriteLine( "The file data will now be retrieved directly, via a new FileStream." );
- Console::WriteLine( "---" );
- myResourceFS = gcnew FileStream( AsmBuilderGetFileDemo::myResourceFileName,FileMode::Open );
- }
-
- StreamReader^ sr = gcnew StreamReader( myResourceFS,System::Text::Encoding::ASCII );
- Console::WriteLine( sr->ReadToEnd() );
- sr->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp
deleted file mode 100644
index 90c18c11fa1..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class TypeBuilderMemberDemo
-{
-public:
- static void DefineDynamicModuleDemo1()
- {
- //
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyAssembly";
- AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly(
- myAsmName, AssemblyBuilderAccess::Run );
-
- // Create a transient dynamic module. Since no DLL name is specified with
- // this constructor, it cannot be saved.
- ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( "MyModule1" );
- //
- }
-
- static void DefineDynamicModuleDemo2()
- {
- //
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyAssembly";
- AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly(
- myAsmName, AssemblyBuilderAccess::Run );
-
- // Create a transient dynamic module. Since no DLL name is specified with
- // this constructor, it can not be saved. By specifying the second parameter
- // of the constructor as false, we can suppress the emission of symbol info.
- ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule(
- "MyModule2", false );
- //
- }
-
- static void DefineDynamicModuleDemo3()
- {
- //
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyAssembly";
- AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly(
- myAsmName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module that can be saved as the specified DLL name.
- ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule(
- "MyModule3", "MyModule3.dll" );
- //
- }
-
- static void DefineDynamicModuleDemo4()
- {
- //
- AppDomain^ myAppDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyAssembly";
- AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly(
- myAsmName, AssemblyBuilderAccess::Run );
-
- // Create a dynamic module that can be saved as the specified DLL name. By
- // specifying the third parameter as true, we can allow the emission of symbol info.
- ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule(
- "MyModule4", "MyModule4.dll", true );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp
deleted file mode 100644
index 7ecadcfc345..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Text;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-// The Point class is the class we will reflect on and copy into our
-// dynamic assembly. The public static function PointMain() will be used
-// as our entry point.
-//
-// We are constructing the type seen here dynamically, and will write it
-// out into a .exe file for later execution from the command-line.
-// ---
-// __gc class Point {
-//
-// private:
-// int x;
-// int y;
-//
-// public:
-// Point(int ix, int iy) {
-//
-// this->x = ix;
-// this->y = iy;
-//
-// }
-//
-// int DotProduct (Point* p) {
-//
-// return ((this->x * p->x) + (this->y * p->y));
-//
-// }
-//
-// static void PointMain() {
-//
-// Console::Write(S"Enter the 'x' value for point 1: ");
-// int x1 = Convert::ToInt32(Console::ReadLine());
-//
-// Console::Write(S"Enter the 'y' value for point 1: ");
-// int y1 = Convert::ToInt32(Console::ReadLine());
-//
-// Console::Write(S"Enter the 'x' value for point 2: ");
-// int x2 = Convert::ToInt32(Console::ReadLine());
-//
-// Console::Write(S"Enter the 'y' value for point 2: ");
-// int y2 = Convert::ToInt32(Console::ReadLine());
-//
-// Point* p1 = new Point(x1, y1);
-// Point* p2 = new Point(x2, y2);
-//
-// Console::WriteLine(S"( {0}, {1}) . ( {2}, {3}) = {4}.",
-// __box(x1), __box(y1), __box(x2), __box(y2), p1->DotProduct(p2));
-//
-// }
-//
-// };
-// ---
-Type^ BuildDynAssembly()
-{
- Type^ pointType = nullptr;
- AppDomain^ currentDom = Thread::GetDomain();
- Console::Write( "Please enter a name for your new assembly: " );
- StringBuilder^ asmFileNameBldr = gcnew StringBuilder;
- asmFileNameBldr->Append( Console::ReadLine() );
- asmFileNameBldr->Append( ".exe" );
- String^ asmFileName = asmFileNameBldr->ToString();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
-
- // We've created a dynamic assembly space - now, we need to create a module
- // within it to reflect the type Point into.
- ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( asmFileName, asmFileName );
- TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Point" );
- FieldBuilder^ xField = myTypeBldr->DefineField( "x", int::typeid, FieldAttributes::Private );
- FieldBuilder^ yField = myTypeBldr->DefineField( "y", int::typeid, FieldAttributes::Private );
-
- // Build the constructor.
- Type^ objType = Type::GetType( "System.Object" );
- ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) );
- array^temp4 = {int::typeid,int::typeid};
- array^ctorParams = temp4;
- ConstructorBuilder^ pointCtor = myTypeBldr->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams );
- ILGenerator^ ctorIL = pointCtor->GetILGenerator();
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Call, objCtor );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_1 );
- ctorIL->Emit( OpCodes::Stfld, xField );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_2 );
- ctorIL->Emit( OpCodes::Stfld, yField );
- ctorIL->Emit( OpCodes::Ret );
-
- // Build the DotProduct method.
- Console::WriteLine( "Constructor built." );
- array^temp0 = {myTypeBldr};
- MethodBuilder^ pointDPBldr = myTypeBldr->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, temp0 );
- ILGenerator^ dpIL = pointDPBldr->GetILGenerator();
- dpIL->Emit( OpCodes::Ldarg_0 );
- dpIL->Emit( OpCodes::Ldfld, xField );
- dpIL->Emit( OpCodes::Ldarg_1 );
- dpIL->Emit( OpCodes::Ldfld, xField );
- dpIL->Emit( OpCodes::Mul_Ovf_Un );
- dpIL->Emit( OpCodes::Ldarg_0 );
- dpIL->Emit( OpCodes::Ldfld, yField );
- dpIL->Emit( OpCodes::Ldarg_1 );
- dpIL->Emit( OpCodes::Ldfld, yField );
- dpIL->Emit( OpCodes::Mul_Ovf_Un );
- dpIL->Emit( OpCodes::Add_Ovf_Un );
- dpIL->Emit( OpCodes::Ret );
-
- // Build the PointMain method.
- Console::WriteLine( "DotProduct built." );
- MethodBuilder^ pointMainBldr = myTypeBldr->DefineMethod( "PointMain", static_cast(MethodAttributes::Public | MethodAttributes::Static), void::typeid, nullptr );
- pointMainBldr->InitLocals = true;
- ILGenerator^ pmIL = pointMainBldr->GetILGenerator();
-
- // We have four methods that we wish to call, and must represent as
- // MethodInfo tokens:
- // - void Console::WriteLine(String*)
- // - String* Console::ReadLine()
- // - int Convert::Int32(String*)
- // - void Console::WriteLine(String*, Object*[])
- array^temp1 = {String::typeid};
- MethodInfo^ writeMI = Console::typeid->GetMethod( "Write", temp1 );
- MethodInfo^ readLineMI = Console::typeid->GetMethod( "ReadLine", gcnew array(0) );
- array^temp2 = {String::typeid};
- MethodInfo^ convertInt32MI = Convert::typeid->GetMethod( "ToInt32", temp2 );
- array^temp5 = {String::typeid,array::typeid};
- array^wlParams = temp5;
- MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams );
-
- // Although we could just refer to the local variables by
- // index (short ints for Ldloc/Stloc, bytes for LdLoc_S/Stloc_S),
- // this time, we'll use LocalBuilders for clarity and to
- // demonstrate their usage and syntax.
- LocalBuilder^ x1LB = pmIL->DeclareLocal( int::typeid );
- LocalBuilder^ y1LB = pmIL->DeclareLocal( int::typeid );
- LocalBuilder^ x2LB = pmIL->DeclareLocal( int::typeid );
- LocalBuilder^ y2LB = pmIL->DeclareLocal( int::typeid );
- LocalBuilder^ point1LB = pmIL->DeclareLocal( myTypeBldr );
- LocalBuilder^ point2LB = pmIL->DeclareLocal( myTypeBldr );
- LocalBuilder^ tempObjArrLB = pmIL->DeclareLocal( array::typeid );
- pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 1: " );
- pmIL->EmitCall( OpCodes::Call, writeMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr );
- pmIL->Emit( OpCodes::Stloc, x1LB );
- pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 1: " );
- pmIL->EmitCall( OpCodes::Call, writeMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr );
- pmIL->Emit( OpCodes::Stloc, y1LB );
- pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 2: " );
- pmIL->EmitCall( OpCodes::Call, writeMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr );
- pmIL->Emit( OpCodes::Stloc, x2LB );
- pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 2: " );
- pmIL->EmitCall( OpCodes::Call, writeMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr );
- pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr );
- pmIL->Emit( OpCodes::Stloc, y2LB );
- pmIL->Emit( OpCodes::Ldloc, x1LB );
- pmIL->Emit( OpCodes::Ldloc, y1LB );
- pmIL->Emit( OpCodes::Newobj, pointCtor );
- pmIL->Emit( OpCodes::Stloc, point1LB );
- pmIL->Emit( OpCodes::Ldloc, x2LB );
- pmIL->Emit( OpCodes::Ldloc, y2LB );
- pmIL->Emit( OpCodes::Newobj, pointCtor );
- pmIL->Emit( OpCodes::Stloc, point2LB );
- pmIL->Emit( OpCodes::Ldstr, "( {0}, {1}) . ( {2}, {3}) = {4}." );
- pmIL->Emit( OpCodes::Ldc_I4_5 );
- pmIL->Emit( OpCodes::Newarr, Object::typeid );
- pmIL->Emit( OpCodes::Stloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldc_I4_0 );
- pmIL->Emit( OpCodes::Ldloc, x1LB );
- pmIL->Emit( OpCodes::Box, int::typeid );
- pmIL->Emit( OpCodes::Stelem_Ref );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldc_I4_1 );
- pmIL->Emit( OpCodes::Ldloc, y1LB );
- pmIL->Emit( OpCodes::Box, int::typeid );
- pmIL->Emit( OpCodes::Stelem_Ref );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldc_I4_2 );
- pmIL->Emit( OpCodes::Ldloc, x2LB );
- pmIL->Emit( OpCodes::Box, int::typeid );
- pmIL->Emit( OpCodes::Stelem_Ref );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldc_I4_3 );
- pmIL->Emit( OpCodes::Ldloc, y2LB );
- pmIL->Emit( OpCodes::Box, int::typeid );
- pmIL->Emit( OpCodes::Stelem_Ref );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->Emit( OpCodes::Ldc_I4_4 );
- pmIL->Emit( OpCodes::Ldloc, point1LB );
- pmIL->Emit( OpCodes::Ldloc, point2LB );
- pmIL->EmitCall( OpCodes::Callvirt, pointDPBldr, nullptr );
- pmIL->Emit( OpCodes::Box, int::typeid );
- pmIL->Emit( OpCodes::Stelem_Ref );
- pmIL->Emit( OpCodes::Ldloc, tempObjArrLB );
- pmIL->EmitCall( OpCodes::Call, writeLineMI, nullptr );
- pmIL->Emit( OpCodes::Ret );
- Console::WriteLine( "PointMain (entry point) built." );
- pointType = myTypeBldr->CreateType();
- Console::WriteLine( "Type completed." );
- myAsmBldr->SetEntryPoint( pointMainBldr );
- myAsmBldr->Save( asmFileName );
- Console::WriteLine( "Assembly saved as ' {0}'.", asmFileName );
- Console::WriteLine( "Type ' {0}' at the prompt to run your new dynamically generated dot product calculator.", asmFileName );
-
- // After execution, this program will have generated and written to disk,
- // in the directory you executed it from, a program named
- // .exe. You can run it by typing
- // the name you gave it during execution, in the same directory where
- // you executed this program.
- return pointType;
-}
-
-int main()
-{
- Type^ myType = BuildDynAssembly();
- Console::WriteLine( "---" );
-
- // Let's invoke the type 'Point' created in our dynamic assembly.
- array^temp3 = {nullptr,nullptr};
- Object^ ptInstance = Activator::CreateInstance( myType, temp3 );
- myType->InvokeMember( "PointMain", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp
deleted file mode 100644
index 5fc4617dce5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ DynamicPointTypeGen()
-{
- Type^ pointType = nullptr;
- array^temp0 = {int::typeid,int::typeid,int::typeid};
- array^ctorParams = temp0;
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" );
- TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public );
- FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public );
- FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public );
- FieldBuilder^ zField = pointTypeBld->DefineField( "z", int::typeid, FieldAttributes::Public );
- Type^ objType = Type::GetType( "System.Object" );
- ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) );
- ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams );
- ILGenerator^ ctorIL = pointCtor->GetILGenerator();
-
- // NOTE: ldarg.0 holds the "this" reference - ldarg.1, ldarg.2, and ldarg.3
- // hold the actual passed parameters. ldarg.0 is used by instance methods
- // to hold a reference to the current calling bject instance. Static methods
- // do not use arg.0, since they are not instantiated and hence no reference
- // is needed to distinguish them.
- ctorIL->Emit( OpCodes::Ldarg_0 );
-
- // Here, we wish to create an instance of System::Object by invoking its
- // constructor, as specified above.
- ctorIL->Emit( OpCodes::Call, objCtor );
-
- // Now, we'll load the current instance in arg 0, along
- // with the value of parameter "x" stored in arg 1, into stfld.
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_1 );
- ctorIL->Emit( OpCodes::Stfld, xField );
-
- // Now, we store arg 2 "y" in the current instance with stfld.
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_2 );
- ctorIL->Emit( OpCodes::Stfld, yField );
-
- // Last of all, arg 3 "z" gets stored in the current instance.
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_3 );
- ctorIL->Emit( OpCodes::Stfld, zField );
-
- // Our work complete, we return.
- ctorIL->Emit( OpCodes::Ret );
-
- // Now, let's create three very simple methods so we can see our fields.
- array^temp1 = {"GetX","GetY","GetZ"};
- array^mthdNames = temp1;
- System::Collections::IEnumerator^ myEnum = mthdNames->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- String^ mthdName = safe_cast(myEnum->Current);
- MethodBuilder^ getFieldMthd = pointTypeBld->DefineMethod( mthdName, MethodAttributes::Public, int::typeid, nullptr );
- ILGenerator^ mthdIL = getFieldMthd->GetILGenerator();
- mthdIL->Emit( OpCodes::Ldarg_0 );
- if ( mthdName->Equals( "GetX" ) )
- mthdIL->Emit( OpCodes::Ldfld, xField );
- else
- if ( mthdName->Equals( "GetY" ) )
- mthdIL->Emit( OpCodes::Ldfld, yField );
- else
- if ( mthdName->Equals( "GetZ" ) )
- mthdIL->Emit( OpCodes::Ldfld, zField );
-
-
-
- mthdIL->Emit( OpCodes::Ret );
- }
-
- pointType = pointTypeBld->CreateType();
-
- // Let's save it, just for posterity.
- myAsmBuilder->Save( "Point.dll" );
- return pointType;
-}
-
-int main()
-{
- Type^ myDynamicType = nullptr;
- Object^ aPoint = nullptr;
- array^temp2 = {int::typeid,int::typeid,int::typeid};
- array^aPtypes = temp2;
- array^temp3 = {4,5,6};
- array^aPargs = temp3;
-
- // Call the method to build our dynamic class.
- myDynamicType = DynamicPointTypeGen();
- Console::WriteLine( "Some information about my new Type '{0}':", myDynamicType->FullName );
- Console::WriteLine( "Assembly: '{0}'", myDynamicType->Assembly );
- Console::WriteLine( "Attributes: '{0}'", myDynamicType->Attributes );
- Console::WriteLine( "Module: '{0}'", myDynamicType->Module );
- Console::WriteLine( "Members: " );
- System::Collections::IEnumerator^ myEnum = myDynamicType->GetMembers()->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- MemberInfo^ member = safe_cast(myEnum->Current);
- Console::WriteLine( "-- {0} {1};", member->MemberType, member->Name );
- }
-
- Console::WriteLine( "---" );
-
- // Let's take a look at the constructor we created.
- ConstructorInfo^ myDTctor = myDynamicType->GetConstructor( aPtypes );
- Console::WriteLine( "Constructor: {0};", myDTctor );
- Console::WriteLine( "---" );
-
- // Now, we get to use our dynamically-created class by invoking the constructor.
- aPoint = myDTctor->Invoke( aPargs );
- Console::WriteLine( "aPoint is type {0}.", aPoint->GetType() );
-
- // Finally, let's reflect on the instance of our new type - aPoint - and
- // make sure everything proceeded according to plan.
- Console::WriteLine( "aPoint.x = {0}", myDynamicType->InvokeMember( "GetX", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) );
- Console::WriteLine( "aPoint.y = {0}", myDynamicType->InvokeMember( "GetY", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) );
- Console::WriteLine( "aPoint.z = {0}", myDynamicType->InvokeMember( "GetZ", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) );
-
- // +++ OUTPUT +++
- // Some information about my new Type 'Point':
- // Assembly: 'MyDynamicAssembly, Version=0.0.0.0'
- // Attributes: 'AutoLayout, AnsiClass, NotPublic, Public'
- // Module: 'PointModule'
- // Members:
- // -- Field x;
- // -- Field y;
- // -- Field z;
- // -- Method GetHashCode;
- // -- Method Equals;
- // -- Method ToString;
- // -- Method GetType;
- // -- Constructor .ctor;
- // ---
- // Constructor: Void .ctor(Int32, Int32, Int32);
- // ---
- // aPoint is type Point.
- // aPoint.x = 4
- // aPoint.y = 5
- // aPoint.z = 6
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp
deleted file mode 100644
index 0529bd4ec8c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-// We will apply this custom attribute to our dynamic type.
-public ref class ClassCreator: public Attribute
-{
-private:
- String^ creator;
-
-public:
-
- property String^ Creator
- {
- String^ get()
- {
- return creator;
- }
-
- }
- ClassCreator( String^ name )
- {
- this->creator = name;
- }
-
-};
-
-
-// We will apply this dynamic attribute to our dynamic method.
-public ref class DateLastUpdated: public Attribute
-{
-private:
- String^ dateUpdated;
-
-public:
-
- property String^ DateUpdated
- {
- String^ get()
- {
- return dateUpdated;
- }
-
- }
- DateLastUpdated( String^ theDate )
- {
- this->dateUpdated = theDate;
- }
-
-};
-
-Type^ BuildTypeWithCustomAttributesOnMethod()
-{
- AppDomain^ currentDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyAssembly";
- AssemblyBuilder^ myAsmBuilder = currentDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run );
- ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyModule" );
-
- // First, we'll build a type with a custom attribute attached.
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType", TypeAttributes::Public );
- array^temp6 = {String::typeid};
- array^ctorParams = temp6;
- ConstructorInfo^ classCtorInfo = ClassCreator::typeid->GetConstructor( ctorParams );
- array^temp0 = {"Joe Programmer"};
- CustomAttributeBuilder^ myCABuilder = gcnew CustomAttributeBuilder( classCtorInfo,temp0 );
- myTypeBuilder->SetCustomAttribute( myCABuilder );
-
- // Now, let's build a method and add a custom attribute to it.
- array^temp1 = gcnew array(0);
- MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, temp1 );
- array^temp7 = {String::typeid};
- ctorParams = temp7;
- classCtorInfo = DateLastUpdated::typeid->GetConstructor( ctorParams );
- array^temp2 = {DateTime::Now.ToString()};
- CustomAttributeBuilder^ myCABuilder2 = gcnew CustomAttributeBuilder( classCtorInfo,temp2 );
- myMethodBuilder->SetCustomAttribute( myCABuilder2 );
- ILGenerator^ myIL = myMethodBuilder->GetILGenerator();
- myIL->EmitWriteLine( "Hello, world!" );
- myIL->Emit( OpCodes::Ret );
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- Type^ myType = BuildTypeWithCustomAttributesOnMethod();
- Object^ myInstance = Activator::CreateInstance( myType );
- array^customAttrs = myType->GetCustomAttributes( true );
- Console::WriteLine( "Custom Attributes for Type 'MyType':" );
- Object^ attrVal = nullptr;
- System::Collections::IEnumerator^ myEnum = customAttrs->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ customAttr = safe_cast(myEnum->Current);
- array^temp3 = gcnew array(0);
- attrVal = ClassCreator::typeid->InvokeMember( "Creator", BindingFlags::GetProperty, nullptr, customAttr, temp3 );
- Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal );
- }
-
- Console::WriteLine( "Custom Attributes for Method 'HelloWorld()' in 'MyType':" );
- customAttrs = myType->GetMember( "HelloWorld" )[ 0 ]->GetCustomAttributes( true );
- System::Collections::IEnumerator^ myEnum2 = customAttrs->GetEnumerator();
- while ( myEnum2->MoveNext() )
- {
- Object^ customAttr = safe_cast(myEnum2->Current);
- array^temp4 = gcnew array(0);
- attrVal = DateLastUpdated::typeid->InvokeMember( "DateUpdated", BindingFlags::GetProperty, nullptr, customAttr, temp4 );
- Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal );
- }
-
- Console::WriteLine( "---" );
- array^temp5 = gcnew array(0);
- Console::WriteLine( myType->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, nullptr, myInstance, temp5 ) );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp
deleted file mode 100644
index 2c62a49f16a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ BuildMyType()
-{
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run );
- ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyJumpTableDemo" );
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "JumpTableDemo", TypeAttributes::Public );
- array^temp0 = {int::typeid};
- MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "SwitchMe", static_cast(MethodAttributes::Public | MethodAttributes::Static), String::typeid, temp0 );
- ILGenerator^ myIL = myMthdBuilder->GetILGenerator();
- Label defaultCase = myIL->DefineLabel();
- Label endOfMethod = myIL->DefineLabel();
-
- // We are initializing our jump table. Note that the labels
- // will be placed later using the MarkLabel method.
- array
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp
deleted file mode 100644
index 06f186f7b7b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class MyDynamicAssembly
-{
-public:
- static void BuildDynamicMethod( TypeBuilder^ myTypeBuilder,
- array^ mthdParamTypes,
- Type^ returnType,
- int addrOfLegacyNumberObject )
- {
- //
- MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod",
- MethodAttributes::Public,
- returnType, mthdParamTypes );
-
- // We will assume that an external unmanaged type "LegacyNumber" has been loaded, and
- // that it has a method "ToString" which returns a String.
-
- MethodInfo^ unmanagedMthdMI = Type::GetType( "LegacyNumber" )->GetMethod( "ToString" );
- ILGenerator^ myMthdIL = myMthdBuilder->GetILGenerator();
-
- // Code to emit various IL opcodes here ...
-
- // Load a reference to the specific Object instance onto the stack.
-
- myMthdIL->Emit( OpCodes::Ldc_I4, addrOfLegacyNumberObject );
- myMthdIL->Emit( OpCodes::Ldobj, Type::GetType( "LegacyNumber" ) );
-
- // Make the call to the unmanaged type method, telling it that the method is
- // the member of a specific instance, to expect a String
- // as a return value, and that there are no explicit parameters.
- myMthdIL->EmitCalli( OpCodes::Calli,
- System::Runtime::InteropServices::CallingConvention::ThisCall,
- String::typeid,
- gcnew array( 0 ) );
-
- // More IL code emission here ...
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp
deleted file mode 100644
index cc26ae7bb54..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ CreateDynamicType()
-{
- array^ctorParams = {int::typeid,int::typeid};
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run );
- ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" );
- TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public );
- FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public );
- FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public );
- Type^ objType = Type::GetType( "System.Object" );
- ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) );
- ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams );
- ILGenerator^ ctorIL = pointCtor->GetILGenerator();
-
- // First, you build the constructor.
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Call, objCtor );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_1 );
- ctorIL->Emit( OpCodes::Stfld, xField );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_2 );
- ctorIL->Emit( OpCodes::Stfld, yField );
- ctorIL->Emit( OpCodes::Ret );
-
- // Now, you'll build a method to output some information on the
- // inside your dynamic class. This method will have the following
- // definition in C#:
- // public void WritePoint()
- MethodBuilder^ writeStrMthd = pointTypeBld->DefineMethod( "WritePoint", MethodAttributes::Public, void::typeid, nullptr );
- ILGenerator^ writeStrIL = writeStrMthd->GetILGenerator();
-
- // The below ILGenerator created demonstrates a few ways to create
- // String* output through STDIN.
- // ILGenerator::EmitWriteLine(String*) will generate a ldstr and a
- // call to WriteLine for you.
- writeStrIL->EmitWriteLine( "The value of this current instance is:" );
-
- // Here, you will do the hard work yourself. First, you need to create
- // the String* we will be passing and obtain the correct WriteLine overload
- // for said String*. In the below case, you are substituting in two values,
- // so the chosen overload is Console::WriteLine(String*, Object*, Object*).
- String^ inStr = "( {0}, {1})";
- array^wlParams = {String::typeid,Object::typeid,Object::typeid};
-
- // We need the MethodInfo to pass into EmitCall later.
- MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams );
-
- // Push the String* with the substitutions onto the stack.
- // This is the first argument for WriteLine - the String* one.
- writeStrIL->Emit( OpCodes::Ldstr, inStr );
-
- // Since the second argument is an Object*, and it corresponds to
- // to the substitution for the value of our integer field, you
- // need to box that field to an Object*. First, push a reference
- // to the current instance, and then push the value stored in
- // field 'x'. We need the reference to the current instance (stored
- // in local argument index 0) so Ldfld can load from the correct
- // instance (this one).
- writeStrIL->Emit( OpCodes::Ldarg_0 );
- writeStrIL->Emit( OpCodes::Ldfld, xField );
-
- // Now, we execute the box opcode, which pops the value of field 'x',
- // returning a reference to the integer value boxed as an Object*.
- writeStrIL->Emit( OpCodes::Box, int::typeid );
-
- // Atop the stack, you'll find our String* inStr, followed by a reference
- // to the boxed value of 'x'. Now, you need to likewise box field 'y'.
- writeStrIL->Emit( OpCodes::Ldarg_0 );
- writeStrIL->Emit( OpCodes::Ldfld, yField );
- writeStrIL->Emit( OpCodes::Box, int::typeid );
-
- // Now, you have all of the arguments for your call to
- // Console::WriteLine(String*, Object*, Object*) atop the stack:
- // the String* InStr, a reference to the boxed value of 'x', and
- // a reference to the boxed value of 'y'.
- // Call Console::WriteLine(String*, Object*, Object*) with EmitCall.
- writeStrIL->EmitCall( OpCodes::Call, writeLineMI, nullptr );
-
- // Lastly, EmitWriteLine can also output the value of a field
- // using the overload EmitWriteLine(FieldInfo).
- writeStrIL->EmitWriteLine( "The value of 'x' is:" );
- writeStrIL->EmitWriteLine( xField );
- writeStrIL->EmitWriteLine( "The value of 'y' is:" );
- writeStrIL->EmitWriteLine( yField );
-
- // Since we return no value (void), the ret opcode will not
- // return the top stack value.
- writeStrIL->Emit( OpCodes::Ret );
- return pointTypeBld->CreateType();
-}
-
-int main()
-{
- array^ctorParams = gcnew array(2);
- Console::Write( "Enter a integer value for X: " );
- String^ myX = Console::ReadLine();
- Console::Write( "Enter a integer value for Y: " );
- String^ myY = Console::ReadLine();
- Console::WriteLine( "---" );
- ctorParams[ 0 ] = Convert::ToInt32( myX );
- ctorParams[ 1 ] = Convert::ToInt32( myY );
- Type^ ptType = CreateDynamicType();
- Object^ ptInstance = Activator::CreateInstance( ptType, ctorParams );
- ptType->InvokeMember( "WritePoint", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp
deleted file mode 100644
index a8bc130aeb6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-int main()
-{
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "AdderExceptionAsm";
- AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName,
- AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( myAsmName->Name,
- myAsmName->Name + ".dll" );
- TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" );
- array^adderParams = {int::typeid,int::typeid};
-
- // This method will add two numbers which are 100 or less. If either of the
- // passed integer vales are greater than 100, it will throw an exception.
- MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd",
- static_cast(MethodAttributes::Public | MethodAttributes::Static),
- int::typeid, adderParams );
- ILGenerator^ adderIL = adderBldr->GetILGenerator();
-
- // Types and methods used in the code to throw, catch, and
- // display OverflowException. Note that if the catch block were
- // for a more general type, such as Exception, we would need
- // a MethodInfo for that type's ToString method.
- //
- Type^ overflow = OverflowException::typeid;
- ConstructorInfo^ exCtorInfo = overflow->GetConstructor(
- gcnew array { String::typeid });
- MethodInfo^ exToStrMI = overflow->GetMethod( "ToString" );
- MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine",
- gcnew array { String::typeid, Object::typeid } );
-
- LocalBuilder^ tmp1 = adderIL->DeclareLocal( int::typeid );
- LocalBuilder^ tmp2 = adderIL->DeclareLocal( overflow );
-
- // In order to successfully branch, we need to create labels
- // representing the offset IL instruction block to branch to.
- // These labels, when the MarkLabel(Label) method is invoked,
- // will specify the IL instruction to branch to.
- //
- Label failed = adderIL->DefineLabel();
- Label endOfMthd = adderIL->DefineLabel();
-
- // Begin the try block.
- Label exBlock = adderIL->BeginExceptionBlock();
-
- // First, load argument 0 and the integer value of S"100" onto the
- // stack. If arg0 > 100, branch to the label S"failed", which is marked
- // as the address of the block that throws an exception.
- adderIL->Emit( OpCodes::Ldarg_0 );
- adderIL->Emit( OpCodes::Ldc_I4_S, 100 );
- adderIL->Emit( OpCodes::Bgt_S, failed );
-
- // Now, check to see if argument 1 was greater than 100. If it was,
- // branch to S"failed." Otherwise, fall through and perform the addition,
- // branching unconditionally to the instruction at the label S"endOfMthd".
- adderIL->Emit( OpCodes::Ldarg_1 );
- adderIL->Emit( OpCodes::Ldc_I4_S, 100 );
- adderIL->Emit( OpCodes::Bgt_S, failed );
-
- adderIL->Emit( OpCodes::Ldarg_0 );
- adderIL->Emit( OpCodes::Ldarg_1 );
- adderIL->Emit( OpCodes::Add_Ovf_Un );
- // Store the result of the addition.
- adderIL->Emit( OpCodes::Stloc_S, tmp1 );
- adderIL->Emit( OpCodes::Br_S, endOfMthd );
-
- // If one of the arguments was greater than 100, we need to throw an
- // exception. We'll use "OverflowException" with a customized message.
- // First, we load our message onto the stack, and then create a new
- // exception Object using the constructor overload that accepts a
- // String* message.
- adderIL->MarkLabel( failed );
- adderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 100 for add." );
- adderIL->Emit( OpCodes::Newobj, exCtorInfo );
-
- // We're going to need to refer to that exception Object later, so let's
- // store it in a temporary variable. Since the store function pops the
- // the value/reference off the stack, and we'll need it to throw the
- // exception, we will subsequently load it back onto the stack as well.
- adderIL->Emit( OpCodes::Stloc_S, tmp2 );
- adderIL->Emit( OpCodes::Ldloc_S, tmp2 );
-
- // Throw the exception now on the stack.
- adderIL->ThrowException( overflow );
-
- // Start the catch block for OverflowException.
- //
- adderIL->BeginCatchBlock( overflow );
-
- // When we enter the catch block, the thrown exception
- // is on the stack. Store it, then load the format string
- // for WriteLine.
- //
- adderIL->Emit(OpCodes::Stloc_S, tmp2);
- adderIL->Emit(OpCodes::Ldstr, "Caught {0}");
-
- // Push the thrown exception back on the stack, then
- // call its ToString() method. Note that if this catch block
- // were for a more general exception type, like Exception,
- // it would be necessary to use the ToString for that type.
- //
- adderIL->Emit(OpCodes::Ldloc_S, tmp2);
- adderIL->EmitCall(OpCodes::Callvirt, exToStrMI, nullptr);
-
- // The format string and the return value from ToString() are
- // now on the stack. Call WriteLine(string, object).
- //
- adderIL->EmitCall( OpCodes::Call, writeLineMI, nullptr );
-
- // Since our function has to return an integer value, we'll load -1 onto
- // the stack to indicate an error, and store it in local variable tmp1.
- adderIL->Emit( OpCodes::Ldc_I4_M1 );
- adderIL->Emit( OpCodes::Stloc_S, tmp1 );
-
- // End the exception handling block.
- adderIL->EndExceptionBlock();
-
- // The end of the method. If no exception was thrown, the correct value
- // will be saved in tmp1. If an exception was thrown, tmp1 will be equal
- // to -1. Either way, we'll load the value of tmp1 onto the stack and return.
- adderIL->MarkLabel( endOfMthd );
- adderIL->Emit( OpCodes::Ldloc_S, tmp1 );
- adderIL->Emit( OpCodes::Ret );
-
- Type^ adderType = myTypeBldr->CreateType();
-
- Object^ addIns = Activator::CreateInstance( adderType );
-
- array^addParams = gcnew array(2);
-
- Console::Write( "Enter an integer value: " );
- addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() );
-
- Console::Write( "Enter another integer value: " );
- addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() );
-
- Console::WriteLine( "If either integer was > 100, an exception will be thrown." );
-
- Console::WriteLine( "---" );
- Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams ) );
-}
-
-/* This code produces output similar to the following:
-
-Enter an integer value: 24
-Enter another integer value: 101
-If either integer was > 100, an exception will be thrown.
----
-Caught System.OverflowException: Arithmetic operation resulted in an overflow.
- at Adder.DoAdd(Int32 , Int32 )
- 24 + 101 = -1
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp
deleted file mode 100644
index 8b29b655e66..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ BuildAdderType()
-{
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "AdderExceptionAsm";
- AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run );
- ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( "AdderExceptionMod" );
- TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" );
- array^adderParams = {int::typeid,int::typeid};
-
- // This method will add two numbers which are 100 or less. If either of the
- // passed integer vales are greater than 100, it will return the value of -1.
- MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams );
- ILGenerator^ adderIL = adderBldr->GetILGenerator();
-
- // In order to successfully branch, we need to create labels
- // representing the offset IL instruction block to branch to.
- // These labels, when the MarkLabel(Label) method is invoked,
- // will specify the IL instruction to branch to.
- Label failed = adderIL->DefineLabel();
- Label endOfMthd = adderIL->DefineLabel();
-
- // First, load argument 0 and the integer value of "100" onto the
- // stack. If arg0 > 100, branch to the label "failed", which is marked
- // as the address of the block that loads -1 onto the stack, bypassing
- // the addition.
- adderIL->Emit( OpCodes::Ldarg_0 );
- adderIL->Emit( OpCodes::Ldc_I4_S, 100 );
- adderIL->Emit( OpCodes::Bgt_S, failed );
-
- // Now, check to see if argument 1 was greater than 100. If it was,
- // branch to "failed." Otherwise, fall through and perform the addition,
- // branching unconditionally to the instruction at the label "endOfMthd".
- adderIL->Emit( OpCodes::Ldarg_1 );
- adderIL->Emit( OpCodes::Ldc_I4_S, 100 );
- adderIL->Emit( OpCodes::Bgt_S, failed );
- adderIL->Emit( OpCodes::Ldarg_0 );
- adderIL->Emit( OpCodes::Ldarg_1 );
- adderIL->Emit( OpCodes::Add_Ovf_Un );
- adderIL->Emit( OpCodes::Br_S, endOfMthd );
-
- // If this label is branched to (the failure case), load -1 onto the stack
- // and fall through to the return opcode.
- adderIL->MarkLabel( failed );
- adderIL->Emit( OpCodes::Ldc_I4_M1 );
-
- // The end of the method. If both values were less than 100, the
- // correct result will return. If one of the arguments was greater
- // than 100, the result will be -1.
- adderIL->MarkLabel( endOfMthd );
- adderIL->Emit( OpCodes::Ret );
- return myTypeBldr->CreateType();
-}
-
-int main()
-{
- Type^ adderType = BuildAdderType();
- Object^ addIns = Activator::CreateInstance( adderType );
- array^addParams = gcnew array(2);
- Console::Write( "Enter an integer value: " );
- addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() );
- Console::Write( "Enter another integer value: " );
- addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() );
- Console::WriteLine( "---" );
- int adderResult = safe_cast(adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams ));
- if ( adderResult != -1 )
- {
- Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderResult );
- }
- else
- {
- Console::WriteLine( "One of the integers to add was greater than 100!" );
- }
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp
deleted file mode 100644
index 13c415b9f79..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-void AddMethodDynamically( TypeBuilder^ myTypeBld,
- String^ mthdName,
- array^ mthdParams,
- Type^ returnType,
- String^ mthdAction )
-{
- MethodBuilder^ myMthdBld = myTypeBld->DefineMethod( mthdName, static_cast(MethodAttributes::Public | MethodAttributes::Static), returnType, mthdParams );
- ILGenerator^ ILOut = myMthdBld->GetILGenerator();
- int numParams = mthdParams->Length;
- for ( Byte x = 0; x < numParams; x++ )
- {
- ILOut->Emit( OpCodes::Ldarg_S, x );
-
- }
- if ( numParams > 1 )
- {
- for ( int y = 0; y < (numParams - 1); y++ )
- {
- if ( mthdAction->Equals( "A" ) )
- ILOut->Emit( OpCodes::Add );
- else
- if ( mthdAction->Equals( "M" ) )
- ILOut->Emit( OpCodes::Mul );
- else
- ILOut->Emit( OpCodes::Add );
-
- }
- }
-
- ILOut->Emit( OpCodes::Ret );
-};
-
-void main()
-{
- AppDomain^ myDomain = AppDomain::CurrentDomain;
- AssemblyName^ asmName = gcnew AssemblyName;
- asmName->Name = "MyDynamicAsm";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( asmName,
- AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ myModule = myAsmBuilder->DefineDynamicModule( "MyDynamicAsm",
- "MyDynamicAsm.dll" );
- TypeBuilder^ myTypeBld = myModule->DefineType( "MyDynamicType",
- TypeAttributes::Public );
-
- // Get info from the user to build the method dynamically.
- Console::WriteLine( "Let's build a simple method dynamically!" );
- Console::WriteLine( "Please enter a few numbers, separated by spaces." );
- String^ inputNums = Console::ReadLine();
- Console::Write( "Do you want to [A]dd (default) or [M]ultiply these numbers? " );
- String^ myMthdAction = Console::ReadLine()->ToUpper();
- Console::Write( "Lastly, what do you want to name your new dynamic method? " );
- String^ myMthdName = Console::ReadLine();
-
- // Process inputNums into an array and create a corresponding Type array
- int index = 0;
- array^inputNumsList = inputNums->Split();
- array^myMthdParams = gcnew array(inputNumsList->Length);
- array^inputValsList = gcnew array(inputNumsList->Length);
- for each (String^ inputNum in inputNumsList)
- {
- inputValsList[ index ] = Convert::ToInt32( inputNum );
- myMthdParams[ index ] = int::typeid;
- index++;
- }
-
-
- // Now, call the method building method with the parameters, passing the
- // TypeBuilder by reference.
- AddMethodDynamically( myTypeBld,
- myMthdName,
- myMthdParams,
- int::typeid,
- myMthdAction );
- Type^ myType = myTypeBld->CreateType();
-
- Console::WriteLine( "---" );
- Console::WriteLine( "The result of {0} the inputted values is: {1}",
- ((myMthdAction->Equals( "M" )) ? "multiplying" : "adding"),
- myType->InvokeMember( myMthdName,
- BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static,
- nullptr,
- nullptr,
- inputValsList ) );
- Console::WriteLine( "---" );
-
- // Let's take a look at the method we created.
- // If you are interested in seeing the MSIL generated dynamically for the method
- // your program generated, change to the directory where you ran the compiled
- // code sample and type "ildasm MyDynamicAsm.dll" at the prompt. When the list
- // of manifest contents appears, click on "MyDynamicType" and then on the name of
- // of the method you provided during execution.
-
- myAsmBuilder->Save( "MyDynamicAsm.dll" );
-
- MethodInfo^ myMthdInfo = myType->GetMethod( myMthdName );
- Console::WriteLine( "Your Dynamic Method: {0};", myMthdInfo );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp
deleted file mode 100644
index e11b9039eea..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-using namespace System;
-using namespace System::Security;
-using namespace System::Security::Permissions;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class MyMethodBuilderDemo
-{
-public:
- static void BuildDynMethod( ModuleBuilder^ myModBuilder )
- {
- //
- // myModBuilder is an instance of ModuleBuilder.
- // Note that for the use of PermissionSet and SecurityAction,
- // the namespaces System::Security and System::Security::Permissions
- // should be included.
-
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType",
- TypeAttributes::Public );
-
- array^ temp0 = {int::typeid, int::typeid};
- MethodBuilder^ myMethod1 = myTypeBuilder->DefineMethod( "MyMethod",
- MethodAttributes::Public,
- int::typeid, temp0 );
-
- PermissionSet^ myMethodPermissions = gcnew PermissionSet(
- PermissionState::Unrestricted );
-
- myMethod1->AddDeclarativeSecurity( SecurityAction::Demand,
- myMethodPermissions );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp
deleted file mode 100644
index b0197f9c238..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-class MoreMethodBuilderSnippets
-{
-public:
- static void ContainerMethod( AssemblyBuilder^ myAsmBuilder )
- {
-
- //
- ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MathFunctions" );
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public );
- array^temp0 = {int::typeid,int::typeid};
- MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "Adder", MethodAttributes::Public, int::typeid, temp0 );
-
- // Create body via ILGenerator here ...
- Type^ myNewType = myTypeBuilder->CreateType();
- Module^ myModule = myMthdBuilder->GetModule();
- array^myModTypes = myModule->GetTypes();
- Console::WriteLine( "Module: {0}", myModule->Name );
- Console::WriteLine( "------- with path {0}", myModule->FullyQualifiedName );
- Console::WriteLine( "------- in assembly {0}", myModule->Assembly->FullName );
- System::Collections::IEnumerator^ myEnum = myModTypes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ myModType = safe_cast(myEnum->Current);
- Console::WriteLine( "------- has type {0}", myModType->FullName );
- }
- }
-
-};
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp
deleted file mode 100644
index 8588434c8e6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-class MoreMethodBuilderSnippets
-{
-public:
- static void ContainerMethod( ModuleBuilder^ myModBuilder )
- {
- //
- TypeBuilder^ myType1 = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public );
- array^temp0 = {Type::GetType( "System.Int32&" ),int::typeid};
- MethodBuilder^ myMthdBuilder = myType1->DefineMethod( "AddToRefValue", MethodAttributes::Public, void::typeid, temp0 );
- ParameterBuilder^ myParam1 = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "thePool" );
- ParameterBuilder^ myParam2 = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "addMeToPool" );
-
- // Create body via ILGenerator here, and complete the type.
- array^myParams = myMthdBuilder->GetParameters();
- Console::WriteLine( "Method: {0}", myMthdBuilder->Name );
-
- for each (ParameterInfo^ myParam in myParams)
- {
- Console::WriteLine("------- Parameter: {0} {1} at pos {2}, with attribute {3}",
- myParam->ParameterType, myParam->Name, myParam->Position,
- myParam->Attributes.ToString());
- }
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp
deleted file mode 100644
index 3f7e32af646..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class MethodBuilderAssortedMembersDemo
-{
-public:
- static void MemberSnippets( TypeBuilder^ myTypeBuilder )
- {
- //
- array^ temp0 = { int::typeid, int::typeid };
- MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod",
- MethodAttributes::Public,
- CallingConventions::HasThis,
- int::typeid,
- temp0 );
-
- // Specifies that the dynamic method declared above has a an MSIL implementation,
- // is managed, synchronized (single-threaded) through the body, and that it
- // cannot be inlined.
-
- myMthdBuilder->SetImplementationFlags( (MethodImplAttributes)(
- MethodImplAttributes::IL |
- MethodImplAttributes::Managed |
- MethodImplAttributes::Synchronized |
- MethodImplAttributes::NoInlining) );
-
- // Create an ILGenerator for the MethodBuilder and emit MSIL here ...
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp
deleted file mode 100644
index 43dd7762fff..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class VariousMethodBuilderSnippets
-{
-public:
- static void ContainerMethod( TypeBuilder^ myDynamicType )
- {
- //
- array^ temp0 = { String::typeid };
- MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethodReturnsMarshal",
- MethodAttributes::Public,
- UInt32::typeid,
- temp0 );
-
- // We want the return value of our dynamic method to be marshalled as
- // an 64-bit (8-Byte) signed integer, instead of the default 32-bit
- // unsigned int as specified above. The UnmanagedMarshal class can perform
- // the type conversion.
-
- UnmanagedMarshal^ marshalMeAsI8 = UnmanagedMarshal::DefineUnmanagedMarshal(
- System::Runtime::InteropServices::UnmanagedType::I8 );
-
- myMethod->SetMarshal( marshalMeAsI8 );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp
deleted file mode 100644
index f2b05b30c44..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-class VariousMethodBuilderSnippets
-{
-public:
- static void ContainerMethod( TypeBuilder^ myDynamicType )
- {
- //
- array^ temp0 = { String::typeid };
- MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethod",
- MethodAttributes::Public,
- int::typeid,
- temp0 );
-
- // A 128-bit key in hex form, represented as a Byte array.
- array^ keyVal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFF, 0xFF};
-
- System::Text::ASCIIEncoding^ encoder = gcnew System::Text::ASCIIEncoding;
- array^ symFullName = encoder->GetBytes( "My Dynamic Method" );
-
- myMethod->SetSymCustomAttribute( "SymID", keyVal );
- myMethod->SetSymCustomAttribute( "SymFullName", symFullName );
- //
- }
-};
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp
deleted file mode 100644
index 2f0d3457db5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-//
-int main()
-{
-
- // We need a blank OpCode Object for reference when calling FieldInfo::GetValue().
- OpCode blankOpCode;
- Type^ myOpCodesType = Type::GetType( "System.Reflection.Emit.OpCodes" );
- array^listOfOpCodes = myOpCodesType->GetFields();
- Console::WriteLine( "Which OpCodes take single-Byte arguments?" );
- Console::WriteLine( "-----------------------------------------" );
-
- // Now, let's reflect on each FieldInfo and create an instance of the OpCode it represents.
- System::Collections::IEnumerator^ myEnum = listOfOpCodes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- FieldInfo^ opCodeFI = safe_cast(myEnum->Current);
- Object^ theOpCode = opCodeFI->GetValue( blankOpCode );
- Console::WriteLine( " {0}: {1}", opCodeFI->Name, OpCodes::TakesSingleByteArgument( *dynamic_cast(theOpCode) ) );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp
deleted file mode 100644
index 7039d6968a8..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ BuildCustomerDataType()
-{
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
- AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run );
- ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyMod" );
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public );
- FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private );
- FieldBuilder^ acctIDBldr = myTypeBuilder->DefineField( "acctID", String::typeid, FieldAttributes::Private );
- FieldBuilder^ balanceAmtBldr = myTypeBuilder->DefineField( "balanceAmt", double::typeid, FieldAttributes::Private );
- array^temp0 = {String::typeid,String::typeid,double::typeid};
- ConstructorBuilder^ myCtorBuilder = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::HasThis, temp0 );
- ILGenerator^ ctorIL = myCtorBuilder->GetILGenerator();
- Type^ objType = Type::GetType( "System.Object" );
- ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Call, objCtor );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_1 );
- ctorIL->Emit( OpCodes::Stfld, customerNameBldr );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_2 );
- ctorIL->Emit( OpCodes::Stfld, acctIDBldr );
- ctorIL->Emit( OpCodes::Ldarg_0 );
- ctorIL->Emit( OpCodes::Ldarg_3 );
- ctorIL->Emit( OpCodes::Stfld, balanceAmtBldr );
- ctorIL->Emit( OpCodes::Ret );
-
- // This method will take an amount from a static pool and add it to the balance.
- // Note that we are passing the first parameter, fundsPool, by reference. Therefore,
- // we need to inform the MethodBuilder to expect a ref, by declaring the first
- // parameter's type to be System::Double& (a reference to a double).
- array^temp4 = {Type::GetType( "System.Double&" ),double::typeid};
- MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "AddFundsFromPool", MethodAttributes::Public, double::typeid, temp4 );
- ParameterBuilder^ poolRefBuilder = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "fundsPool" );
- ParameterBuilder^ amountFromPoolBuilder = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "amountFromPool" );
- ILGenerator^ mthdIL = myMthdBuilder->GetILGenerator();
- mthdIL->Emit( OpCodes::Ldarg_1 );
- mthdIL->Emit( OpCodes::Ldarg_1 );
- mthdIL->Emit( OpCodes::Ldind_R8 );
- mthdIL->Emit( OpCodes::Ldarg_2 );
- mthdIL->Emit( OpCodes::Sub );
- mthdIL->Emit( OpCodes::Stind_R8 );
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr );
- mthdIL->Emit( OpCodes::Ldarg_2 );
- mthdIL->Emit( OpCodes::Add );
- mthdIL->Emit( OpCodes::Stfld, balanceAmtBldr );
- mthdIL->Emit( OpCodes::Ldarg_0 );
- mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr );
- mthdIL->Emit( OpCodes::Ret );
- return myTypeBuilder->CreateType();
-}
-
-int main()
-{
- Type^ custType = nullptr;
- Object^ custObj = nullptr;
- array^custArgTypes = {String::typeid,String::typeid,double::typeid};
-
- // Call the method to build our dynamic class.
- custType = BuildCustomerDataType();
- Console::WriteLine( "---" );
- ConstructorInfo^ myCustCtor = custType->GetConstructor( custArgTypes );
- double initialBalance = 100.00;
- array^temp5 = {"Joe Consumer","5678-XYZ",initialBalance};
- custObj = myCustCtor->Invoke( temp5 );
- array^myMemberInfo = custType->GetMember( "AddFundsFromPool" );
- double thePool = 1000.00;
- Console::WriteLine( "The pool is currently ${0}", thePool );
- Console::WriteLine( "The original balance of the account instance is ${0}", initialBalance );
- double amountFromPool = 50.00;
- Console::WriteLine( "The amount to be subtracted from the pool and added to the account is ${0}", amountFromPool );
- Console::WriteLine( "---" );
- Console::WriteLine( "Calling {0} ...", myMemberInfo[ 0 ] );
- Console::WriteLine( "---" );
- array^passMe = {thePool,amountFromPool};
- Console::WriteLine( "The new balance in the account instance is ${0}", custType->InvokeMember( "AddFundsFromPool", BindingFlags::InvokeMethod, nullptr, custObj, passMe ) );
- thePool = safe_cast(passMe[ 0 ]);
- Console::WriteLine( "The new amount in the pool is ${0}", thePool );
-}
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp
deleted file mode 100644
index 8f782758f2a..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Threading;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-Type^ BuildDynamicTypeWithProperties()
-{
- AppDomain^ myDomain = Thread::GetDomain();
- AssemblyName^ myAsmName = gcnew AssemblyName;
- myAsmName->Name = "MyDynamicAssembly";
-
- // To generate a persistable assembly, specify AssemblyBuilderAccess::RunAndSave.
- AssemblyBuilder^ myAsmBuilder =
- myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
-
- // Generate a persistable single-module assembly.
- ModuleBuilder^ myModBuilder =
- myAsmBuilder->DefineDynamicModule( myAsmName->Name, myAsmName->Name + ".dll" );
- TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public );
-
- // Define a private field to hold the property value.
- FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private );
-
- // The last argument of DefineProperty is an empty array of Type
- // objects, because the property has no parameters. (Alternatively,
- // you can specify a null value.)
- PropertyBuilder^ custNamePropBldr =
- myTypeBuilder->DefineProperty( "CustomerName", PropertyAttributes::HasDefault, String::typeid, gcnew array(0) );
-
- // The property set and property get methods require a special
- // set of attributes.
- MethodAttributes getSetAttr =
- MethodAttributes::Public | MethodAttributes::SpecialName |
- MethodAttributes::HideBySig;
-
- // Define the "get" accessor method for CustomerName.
- MethodBuilder^ custNameGetPropMthdBldr =
- myTypeBuilder->DefineMethod( "get_CustomerName",
- getSetAttr,
- String::typeid,
- Type::EmptyTypes );
-
- ILGenerator^ custNameGetIL = custNameGetPropMthdBldr->GetILGenerator();
- custNameGetIL->Emit( OpCodes::Ldarg_0 );
- custNameGetIL->Emit( OpCodes::Ldfld, customerNameBldr );
- custNameGetIL->Emit( OpCodes::Ret );
-
- // Define the "set" accessor method for CustomerName.
- array^temp2 = {String::typeid};
- MethodBuilder^ custNameSetPropMthdBldr =
- myTypeBuilder->DefineMethod( "set_CustomerName",
- getSetAttr,
- nullptr,
- temp2 );
-
- ILGenerator^ custNameSetIL = custNameSetPropMthdBldr->GetILGenerator();
- custNameSetIL->Emit( OpCodes::Ldarg_0 );
- custNameSetIL->Emit( OpCodes::Ldarg_1 );
- custNameSetIL->Emit( OpCodes::Stfld, customerNameBldr );
- custNameSetIL->Emit( OpCodes::Ret );
-
- // Last, we must map the two methods created above to our PropertyBuilder to
- // their corresponding behaviors, "get" and "set" respectively.
- custNamePropBldr->SetGetMethod( custNameGetPropMthdBldr );
- custNamePropBldr->SetSetMethod( custNameSetPropMthdBldr );
-
- Type^ retval = myTypeBuilder->CreateType();
-
- // Save the assembly so it can be examined with Ildasm.exe,
- // or referenced by a test program.
- myAsmBuilder->Save(myAsmName->Name + ".dll");
- return retval;
-}
-
-int main()
-{
- Type^ custDataType = BuildDynamicTypeWithProperties();
- array^custDataPropInfo = custDataType->GetProperties();
- System::Collections::IEnumerator^ myEnum = custDataPropInfo->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- PropertyInfo^ pInfo = safe_cast(myEnum->Current);
- Console::WriteLine( "Property '{0}' created!", pInfo );
- }
-
- Console::WriteLine( "---" );
-
- // Note that when invoking a property, you need to use the proper BindingFlags -
- // BindingFlags::SetProperty when you invoke the "set" behavior, and
- // BindingFlags::GetProperty when you invoke the "get" behavior. Also note that
- // we invoke them based on the name we gave the property, as expected, and not
- // the name of the methods we bound to the specific property behaviors.
- Object^ custData = Activator::CreateInstance( custDataType );
- array^temp3 = {"Joe User"};
- custDataType->InvokeMember( "CustomerName", BindingFlags::SetProperty, nullptr, custData, temp3 );
- Console::WriteLine( "The customerName field of instance custData has been set to '{0}'.", custDataType->InvokeMember( "CustomerName", BindingFlags::GetProperty, nullptr, custData, gcnew array(0) ) );
-}
-
-// --- O U T P U T ---
-// The output should be as follows:
-// -------------------
-// Property 'System.String CustomerName' created!
-// ---
-// The customerName field of instance custData has been set to 'Joe User'.
-// -------------------
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp
deleted file mode 100644
index bfeecb340d6..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-using namespace System::Threading;
-using namespace System::Text;
-using namespace System::Resources;
-using namespace System::Collections;
-using namespace System::IO;
-
-// Helper class called when a resolve type event is raised.
-ref class TypeResolveHandler
-{
-private:
- Module^ m_Module;
-
-public:
- TypeResolveHandler( Module^ mod )
- {
- m_Module = mod;
- }
-
- Assembly^ ResolveEvent( Object^ sender, ResolveEventArgs^ args );
-};
-
-ref class NestedEnum
-{
-internal:
- static TypeBuilder^ enumType = nullptr;
- static Type^ tNested = nullptr;
- static Type^ tNesting = nullptr;
-
-public:
- static void Main()
- {
- AssemblyName^ asmName = gcnew AssemblyName;
- asmName->Name = "NestedEnum";
- AssemblyBuilder^ asmBuild = Thread::GetDomain()->DefineDynamicAssembly( asmName, AssemblyBuilderAccess::RunAndSave );
- ModuleBuilder^ modBuild = asmBuild->DefineDynamicModule( "ModuleOne", "NestedEnum.dll" );
-
- // Hook up the event listening.
- TypeResolveHandler^ typeResolveHandler = gcnew TypeResolveHandler( modBuild );
-
- // Add a listener for the type resolve events.
- AppDomain^ currentDomain = Thread::GetDomain();
- ResolveEventHandler^ resolveHandler = gcnew ResolveEventHandler( typeResolveHandler, &TypeResolveHandler::ResolveEvent );
- currentDomain->TypeResolve += resolveHandler;
- TypeBuilder^ tb = modBuild->DefineType( "AType", TypeAttributes::Public );
- TypeBuilder^ eb = tb->DefineNestedType( "AnEnum", static_cast(TypeAttributes::NestedPublic | TypeAttributes::Sealed), Enum::typeid, 0 );
- eb->DefineField( "value__", int::typeid, static_cast(FieldAttributes::Private | FieldAttributes::SpecialName) );
- FieldBuilder^ fb = eb->DefineField( "Field1", eb, static_cast(FieldAttributes::Public | FieldAttributes::Literal | FieldAttributes::Static) );
- fb->SetConstant( 1 );
- enumType = eb;
-
- // Comment out this field.
- // When this field is defined, the loader cannot determine the size
- // of the type. Therefore, a TypeResolve event is generated when the
- // nested type is completed.
- tb->DefineField( "Field2", eb, FieldAttributes::Public );
- tNesting = tb->CreateType();
- if ( tNesting == nullptr )
- Console::WriteLine( "NestingType CreateType failed but didn't throw!" );
-
- try
- {
- tNested = eb->CreateType();
- if ( tNested == nullptr )
- Console::WriteLine( "NestedType CreateType failed but didn't throw!" );
- }
- catch ( Exception^ )
- {
-
- // This is needed because you might have already completed the type in the TypeResolve event.
- }
-
- if ( tNested != nullptr )
- {
- Type^ x = tNested->DeclaringType;
- if ( x == nullptr )
- Console::WriteLine( "Declaring type is null." );
- else
- Console::WriteLine( x->Name );
- }
-
- asmBuild->Save( "NestedEnum.dll" );
-
- // Remove the listener for the type resolve events.
- currentDomain->TypeResolve -= resolveHandler;
- }
-
-};
-
-Assembly^ TypeResolveHandler::ResolveEvent( Object^ sender, ResolveEventArgs^ args )
-{
- Console::WriteLine( args->Name );
-
- // Use args.Name to look up the type name. In this case, you are getting AnEnum.
- try
- {
- NestedEnum::tNested = NestedEnum::enumType->CreateType();
- }
- catch ( Exception^ )
- {
-
- // This is needed to throw away InvalidOperationException.
- // Loader might send the TypeResolve event more than once
- // and the type might be complete already.
- }
-
-
- // Complete the type.
- return m_Module->Assembly;
-}
-
-int main()
-{
- NestedEnum::Main();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp
deleted file mode 100644
index 8f8a66f0c27..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-public ref class Test
-{
-public:
- virtual String^ ToString() override
- {
- return "An instance of class Test!";
- }
-};
-
-int main()
-{
- Test^ target = gcnew Test();
- MethodInfo^ toStringInfo = target->GetType()->GetMethod("ToString");
- Console::WriteLine("{0} is defined in {1}", toStringInfo->Name,
- toStringInfo->Module->Name);
-
- MethodInfo^ getHashCodeInfo = target->GetType()->GetMethod("GetHashCode");
- Console::WriteLine("{0} is defined in {1}", getHashCodeInfo->Name,
- getHashCodeInfo->Module->Name);
-}
-
-/*
-* This example produces the following console output:
-*
-* ToString is defined in source.exe
-* GetHashCode is defined in mscorlib.dll
-*/
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp
deleted file mode 100644
index 2ba285b7284..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-// The base class Parent contains an overloaded method PrintCall.
-//
-public ref class Parent
-{
-public:
- virtual void PrintCall()
- {
- Console::WriteLine("Parent's PrintCall()");
- }
-public:
- virtual void PrintCall(int x)
- {
- Console::WriteLine("Parent's PrintCall({0})", x);
- }
-};
-
-// The derived class Child hides one overload of the inherited
-// method PrintCall.
-//
-public ref class Child : public Parent
-{
-public:
- void PrintCall(int i) new
- {
- Console::WriteLine("Child's PrintCall({0})", i);
- }
-};
-
-int main()
-{
- Child^ childInstance = gcnew Child();
-
- // In C#, the method in the derived class hides by name and by
- // signature, so the overload in the derived class hides only one
- // of the overloads in the base class.
- //
- Console::WriteLine("------ List the overloads of PrintCall in the " +
- "derived class Child ------");
- Type^ t = childInstance->GetType();
- for each(MethodInfo^ minfo in t->GetMethods())
- {
- if (minfo->Name == "PrintCall")
- {
- Console::WriteLine("Overload of PrintCall: {0}" +
- " IsHideBySig = {1}, DeclaringType = {2}",
- minfo, minfo->IsHideBySig, minfo->DeclaringType);
- }
- }
-
- // The method PrintCall in the derived class hides one overload of the
- // method in Parent. Contrast this with Visual Basic, which hides by
- // name instead of by name and signature. In Visual Basic, the
- // parameterless overload of PrintCall would be unavailable from Child.
- //
- Console::WriteLine(
- "------ Call the overloads of PrintCall available in Child ------");
- childInstance->PrintCall();
- childInstance->PrintCall(42);
-
- // If Child is cast to the base type Parent, both overloads of the
- // shadowed method can be called.
- //
- Console::WriteLine(
- "------ Call the shadowed overloads of PrintCall ------");
- Parent^ parentInstance = childInstance;
- parentInstance->PrintCall();
- parentInstance->PrintCall(42);
-}
-
-/* This code example produces the following output:
-
------- List the overloads of PrintCall in the derived class Child ------
-Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Child
-Overload of PrintCall: Void PrintCall() IsHideBySig = True, DeclaringType = Parent
-Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Parent
------- Call the overloads of PrintCall available in Child ------
-Parent's PrintCall()
-Child's PrintCall(42)
------- Call the shadowed overloads of PrintCall ------
-Parent's PrintCall()
-Parent's PrintCall(42)
-
-*/
-
-//
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp
deleted file mode 100644
index 2fca1e3a971..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing this class.
- Module^ myModule = moduleArray[ 0 ];
- Assembly^ myAssembly = myModule->Assembly;
- Console::WriteLine( "myModule.Assembly = {0}.", myAssembly->FullName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp
deleted file mode 100644
index 82159ee05f7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-public ref class MySecondClass{};
-
-
-// This class does not fit the filter criterion My*.
-public ref class YourClass{};
-
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- Module^ myModule = moduleArray[ 0 ];
- array^tArray;
- tArray = myModule->FindTypes( Module::FilterTypeName, "My*" );
- IEnumerator^ myEnum = tArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ t = safe_cast(myEnum->Current);
- Console::WriteLine( "Found a module beginning with My*: {0}.", t->Name );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp
deleted file mode 100644
index 3aa584f6d2c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-public ref class MyMainClass{};
-
-public ref class MySecondClass{};
-
-
-// This class does not fit the filter criteria my*.
-public ref class YourClass{};
-
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- Module^ myModule = moduleArray[ 0 ];
- array^tArray;
- tArray = myModule->FindTypes( Module::FilterTypeNameIgnoreCase, "my*" );
- IEnumerator^ myEnum = tArray->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Type^ t = safe_cast(myEnum->Current);
- Console::WriteLine( "Found a module beginning with my*: {0}", t->Name );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp
deleted file mode 100644
index 68633196a7c..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing this class.
- Module^ myModule = moduleArray[ 0 ];
- Console::WriteLine( "myModule.FullyQualifiedName = {0}", myModule->FullyQualifiedName );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp
deleted file mode 100644
index 38137adc219..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-
-namespace ReflectionModule_Examples
-{
-
- //Define a module-level attribute.
- //A very simple custom attribute.
-
- [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)]
- public ref class MySimpleAttribute: public Attribute
- {
- private:
- String^ name;
-
- public:
- MySimpleAttribute( String^ newName )
- {
- name = newName;
- }
-
- };
-
-
- [module:MySimpleAttribute("module-level")];
- ref class MyMainClass{};
-
-}
-
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- System::Reflection::Module^ myModule = moduleArray[ 0 ];
- array^attributes;
- attributes = myModule->GetCustomAttributes( true );
- IEnumerator^ myEnum = attributes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::WriteLine( "Found this attribute on myModule: {0}.", o );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp
deleted file mode 100644
index 3cf8509d34b..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Collections;
-
-namespace ReflectionModule_Examples
-{
-
- // Define a very simple custom attribute
-
- [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)]
- public ref class MySimpleAttribute: public Attribute
- {
- private:
- String^ name;
-
- public:
- MySimpleAttribute( String^ newName )
- {
- name = newName;
- }
-
- };
-
-}
-
-
-//Define a module-level attribute.
-
-[module:ReflectionModule_Examples::MySimpleAttribute("module-level")];
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false );
-
- // In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- System::Reflection::Module^ myModule = moduleArray[ 0 ];
- array^attributes;
-
- //Get only MySimpleAttribute attributes for this module.
- attributes = myModule->GetCustomAttributes( myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute", false, false ), true );
- IEnumerator^ myEnum = attributes->GetEnumerator();
- while ( myEnum->MoveNext() )
- {
- Object^ o = safe_cast(myEnum->Current);
- Console::WriteLine( "Found this attribute on myModule: {0}", o );
- }
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp
deleted file mode 100644
index e7972909d1e..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace ReflectionModule_Examples
-{
- public ref class MyMainClass{};
-
-}
-
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- Module^ myModule = moduleArray[ 0 ];
- Type^ myType;
- myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass" );
- Console::WriteLine( "Got type: {0}", myType );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp
deleted file mode 100644
index 7c898abb0c9..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace ReflectionModule_Examples
-{
- public ref class MyMainClass{};
-
-}
-
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- Module^ myModule = moduleArray[ 0 ];
- Type^ myType;
- myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false );
- Console::WriteLine( "Got type: {0}", myType );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp
deleted file mode 100644
index 3759068bbe0..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace ReflectionModule_Examples
-{
- public ref class MyMainClass{};
-
-}
-
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing this class.
- Module^ myModule = moduleArray[ 0 ];
- Type^ myType;
- myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false, false );
- Console::WriteLine( "Got type: {0}", myType );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp
deleted file mode 100644
index 651c5025f0d..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-
-namespace ReflectionModule_Examples
-{
-
- //A very simple custom attribute.
-
- [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)]
- public ref class MySimpleAttribute: public Attribute
- {
- private:
- String^ name;
-
- public:
- MySimpleAttribute( String^ newName )
- {
- name = newName;
- }
-
- };
-
-}
-
-
-//Define a module-level attribute.
-
-[module:ReflectionModule_Examples::MySimpleAttribute("module-level")];
-int main()
-{
- array^moduleArray;
- moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing these classes.
- System::Reflection::Module^ myModule = moduleArray[ 0 ];
- Type^ myType;
- myType = myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute" );
- Console::WriteLine( "IsDefined(MySimpleAttribute) = {0}", myModule->IsDefined( myType, false ) );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp
deleted file mode 100644
index 41922a945e4..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing this class.
- Module^ myModule = moduleArray[ 0 ];
- Console::WriteLine( "myModule->IsResource() = {0}", myModule->IsResource() );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp
deleted file mode 100644
index bd17af9afb2..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-
-//
-using namespace System;
-using namespace System::Reflection;
-int main()
-{
- array^moduleArray;
- moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
-
- //In a simple project with only one module, the module at index
- // 0 will be the module containing this class.
- Module^ myModule = moduleArray[ 0 ];
- Console::WriteLine( "myModule->ToString returns: {0}", myModule );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp
deleted file mode 100644
index 8720dbc53fd..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-using namespace System;
-using namespace System::Collections;
-using namespace System::Reflection;
-
-// Define a sample interface to use as an interface constraint.
-interface class ITest{};
-
-// Define a base type to use as a class constraint.
-public ref class Base{};
-
-// Define the generic type to examine. The first generic type parameter,
-// T, derives from the class Base and implements ITest. This demonstrates
-// a base class constraint and an interface constraint. In the .NET
-// Framework version 2.0, C++ has no way of expressing special constraints.
-// See the C# example code.
-//
-generic
- where T : Base, ITest
-ref class Test {};
-
-// Define a type that derives from Base and implements interface
-// ITest. This type satisfies the constraint on T in class Test.
-public ref class Derived: public Base, public ITest {};
-
-public ref class Example
-{
-public:
- static void Main()
- {
- // Create a constructed type from Test, and from it
- // get the generic type definition.
- //
- Type^ def = Test::typeid;
- Console::WriteLine( L"\r\nExamining generic type {0}", def );
-
- // Get the type parameters of the generic type definition,
- // and display them.
- //
- for each (Type^ tp in def->GetGenericArguments())
- {
- Console::WriteLine( L"\r\nType parameter: {0}", tp);
- Console::WriteLine( L"\t{0}",
- ListGenericParameterAttributes( tp ) );
-
- // List the base class and interface constraints. The
- // constraints do not appear in any particular order. If
- // there are no class or interface constraints, an empty
- // array is returned.
- //
- for each (Type^ constraint in tp->GetGenericParameterConstraints())
- {
- Console::WriteLine( L"\t{0}", constraint );
- }
- }
- }
-
-private:
-
- // List the variance and special constraint flags.
- //
- static String^ ListGenericParameterAttributes( Type^ t )
- {
- String^ retval;
- GenericParameterAttributes gpa = t->GenericParameterAttributes;
-
- // Select the variance flag.
- GenericParameterAttributes variance =
- static_cast(
- gpa & GenericParameterAttributes::VarianceMask );
-
- if ( variance == GenericParameterAttributes::None )
- retval = L"No variance flag;";
- else
- {
- if ( (variance & GenericParameterAttributes::Covariant) !=
- GenericParameterAttributes::None )
- retval = L"Covariant;";
- else
- retval = L"Contravariant;";
- }
-
- // Select the special constraint flags.
- GenericParameterAttributes constraints =
- static_cast(
- gpa & GenericParameterAttributes::SpecialConstraintMask);
-
- if ( constraints == GenericParameterAttributes::None )
- retval = String::Concat( retval, L" No special constraints" );
- else
- {
- if ( (constraints & GenericParameterAttributes::ReferenceTypeConstraint) !=
- GenericParameterAttributes::None )
- retval = String::Concat( retval, L" ReferenceTypeConstraint" );
-
- if ( (constraints & GenericParameterAttributes::NotNullableValueTypeConstraint) !=
- GenericParameterAttributes::None )
- retval = String::Concat( retval, L" NotNullableValueTypeConstraint" );
-
- if ( (constraints & GenericParameterAttributes::DefaultConstructorConstraint) !=
- GenericParameterAttributes::None )
- retval = String::Concat( retval, L" DefaultConstructorConstraint" );
- }
-
- return retval;
- }
-};
-
-int main()
-{
- Example::Main();
-}
-
-/* This example produces the following output:
-
-Examining generic type Test`2[T,U]
-
-Type parameter: T
- No variance flag; No special constraints
- Base
- ITest
-
-Type parameter: U
- No variance flag; No special constraints
- */
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp
deleted file mode 100644
index 2b795397fac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Use attributes to mark the class as serializable and obsolete.
- CodeAttributeDeclaration^ codeAttrDecl =
- gcnew CodeAttributeDeclaration("System.Serializable");
- class1->CustomAttributes->Add(codeAttrDecl);
-
- CodeAttributeArgument^ codeAttr =
- gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression("This class is obsolete."));
- codeAttrDecl = gcnew CodeAttributeDeclaration("System.Obsolete", codeAttr);
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//[System.Serializable()]
-//[System.Obsolete("This class is obsolete.")]
-//public class Class1 {
-//}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp
deleted file mode 100644
index 5523f2c37c7..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declare a new code attribute
- CodeAttributeDeclaration^ codeAttrDecl = gcnew CodeAttributeDeclaration(
- "System.CLSCompliantAttribute",
- gcnew CodeAttributeArgument(gcnew CodePrimitiveExpression(false)));
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//[System.CLSCompliantAttribute(false)]
-//public class Class1 {
-//}
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp
deleted file mode 100644
index 4db196685db..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declares a type constructor that calls a method.
- CodeConstructor^ constructor1 = gcnew CodeConstructor();
- constructor1->Attributes = MemberAttributes::Public;
- class1->Members->Add(constructor1);
-
- // Creates a method reference for dict.Init.
- CodeMethodReferenceExpression^ methodRef1 =
- gcnew CodeMethodReferenceExpression(
- gcnew CodeVariableReferenceExpression("dict"),
- "Init",
- gcnew array {
- gcnew CodeTypeReference("System.Decimal"),
- gcnew CodeTypeReference("System.Int32")});
-
- // Invokes the dict.Init method from the constructor.
- CodeMethodInvokeExpression^ invoke1 =
- gcnew CodeMethodInvokeExpression(methodRef1, gcnew array {});
- constructor1->Statements->Add(invoke1);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-//public class Class1 {
-//
-// public Class1() {
-// dict.Init();
-// }
-// }
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp
deleted file mode 100644
index dcd7661e4aa..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::CodeDom;
-using namespace System::CodeDom::Compiler;
-
-int main()
-{
- // Declare a new type called Class1.
- CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1");
-
- // Declare a new generated code attribute
- GeneratedCodeAttribute^ generatedCodeAttribute =
- gcnew GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0");
-
- // Use the generated code attribute members in the attribute declaration
- CodeAttributeDeclaration^ codeAttrDecl =
- gcnew CodeAttributeDeclaration(generatedCodeAttribute->GetType()->Name,
- gcnew CodeAttributeArgument(
- gcnew CodePrimitiveExpression(generatedCodeAttribute->Tool)),
- gcnew CodeAttributeArgument(
- gcnew CodePrimitiveExpression(generatedCodeAttribute->Version)));
- class1->CustomAttributes->Add(codeAttrDecl);
-
- // Create a C# code provider
- CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp");
-
- // Generate code and send the output to the console
- provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions());
-}
-
-// The CPP code generator produces the following source code for the preceeding example code:
-//
-// [GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0")]
-// public class Class1 {
-// }
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp
deleted file mode 100644
index f2ad3ec6d43..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-using namespace System;
-using namespace System::Reflection;
-
-ref class Example
-{};
-
-void main()
-{
- // Get the assembly from a known type in that assembly.
- Type^ t = Example::typeid;
- Assembly^ assemFromType = t->Assembly;
- Console::WriteLine("Assembly that contains Example:");
- Console::WriteLine(" {0}\n", assemFromType->FullName);
-
- // Get the currently executing assembly.
- Assembly^ currentAssem = Assembly::GetExecutingAssembly();
- Console::WriteLine("Currently executing assembly:");
- Console::WriteLine(" {0}\n", currentAssem->FullName);
-
- Console::WriteLine("The two Assembly objects are equal: {0}",
- assemFromType->Equals(currentAssem));
-}
-// The example displays the following output:
-// Assembly that contains Example:
-// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-//
-// Currently executing assembly:
-// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-//
-// The two Assembly objects are equal: True
-//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp
deleted file mode 100644
index 31f5e221cac..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Reflection::Emit;
-
-public ref class CompareGenericTypes
-{
-public:
- static void Main()
- {
- try
- {
- AppDomain^ currentDomain = AppDomain::CurrentDomain;
-
- AssemblyName^ aName = gcnew AssemblyName("TempAssembly");
- AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly(aName, AssemblyBuilderAccess::Run);
-
- ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name);
-
- TypeBuilder^ tbldr = mb->DefineType("MyNewType", TypeAttributes::Public);
- tbldr->DefineGenericParameters("T");
- //
- Type^ t1 = tbldr->MakeGenericType(String::typeid);
- Type^ t2 = tbldr->MakeGenericType(String::typeid);
- bool result = t1->Equals(t2);
- //
- Console::WriteLine("Types t1 and t2 match: {0:s}", result ? "Yes" : "No");
- }
- catch (Exception^ ex)
- {
- Console::WriteLine(ex->Message);
- Console::WriteLine(ex->StackTrace);
- }
- }
-};
-
-int main()
-{
- CompareGenericTypes::Main();
-}
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp
deleted file mode 100644
index 7f81c1fa446..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-
-public ref class FieldAttribTest
-{
-public:
- static int field1 = 99;
-
- static void Main()
- {
- Object^ obj = gcnew FieldAttribTest();
-
- //
- FieldInfo^ fi = obj->GetType()->GetField("field1");
-
- if ((fi->Attributes & FieldAttributes::FieldAccessMask) ==
- FieldAttributes::Public)
- {
- Console::WriteLine("{0:s} is public. Value: {1:d}", fi->Name, fi->GetValue(obj));
- }
- //
- }
-};
-
-int main()
-{
- FieldAttribTest::Main();
-}
-
-
-
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp
deleted file mode 100644
index 588767ccad5..00000000000
--- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-using namespace System;
-using namespace System::Reflection;
-
-public ref class ParmInfoTest
-{
-public:
- static void Main()
- {
- Object^ obj = gcnew ParmInfoTest;
-
- //
- // Create an array containing the arguments.
- array^ args = {"Argument 1", "Argument 2", "Argument 3" };
-
- // Initialize a ParameterModifier with the number of parameters.
- ParameterModifier p = ParameterModifier(3);
-
- // Pass the first and third parameters by reference.
- p[0] = true;
- p[2] = true;
-
- // The ParameterModifier must be passed as the single element
- // of an array.
-
- array^ mods = { p };
-
- // Invoke the method late bound.
- obj->GetType()->InvokeMember("MethodName", BindingFlags::InvokeMethod,
- nullptr, obj, args, mods, nullptr, nullptr);
- //
- }
-
- void MethodName(String^% str1, String^ str2, String^% str3)
- {
- Console::WriteLine("Called 'MethodName'");
- }
-};
-
-int main()
-{
- ParmInfoTest::Main();
-}
-
-
-
diff --git a/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp b/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp
deleted file mode 100644
index 75adbf6a471..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-#using
-
-using namespace System;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-using namespace System::Xml::XPath;
-
-class XPathValidation
-{
-public:
-
- static void Main()
- {
- try
- {
- XmlReaderSettings^ settings = gcnew XmlReaderSettings();
- settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd");
- settings->ValidationType = ValidationType::Schema;
-
- XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings);
- XmlDocument^ document = gcnew XmlDocument();
- document->Load(reader);
-
- ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(ValidationEventHandlerOne);
-
- // the following call to Validate succeeds.
- document->Validate(eventHandler);
-
- // add a node so that the document is no longer valid
- XPathNavigator^ navigator = document->CreateNavigator();
- navigator->MoveToFollowing("price", "http://www.contoso.com/books");
- XmlWriter^ writer = navigator->InsertAfter();
- writer->WriteStartElement("anotherNode", "http://www.contoso.com/books");
- writer->WriteEndElement();
- writer->Close();
-
- // the document will now fail to successfully validate
- document->Validate(eventHandler);
- }
- catch(Exception^ ex)
- {
- Console::WriteLine(ex->Message);
- }
- }
-
- static void ValidationEventHandlerOne(Object^ sender, ValidationEventArgs^ e)
- {
- switch (e->Severity)
- {
- case XmlSeverityType::Error:
- Console::WriteLine("Error: {0}", e->Message);
- break;
- case XmlSeverityType::Warning:
- Console::WriteLine("Warning {0}", e->Message);
- break;
- }
-
- }
-};
-
-int main()
-{
- XPathValidation::Main();
- Console::ReadLine();
- return 0;
-};
-//
\ No newline at end of file
diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp
deleted file mode 100644
index 2b1b5ca9f4d..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Net;
-int main()
-{
-
- // Supply the credentials necessary to access the DTD file stored on the network.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- resolver->Credentials = CredentialCache::DefaultCredentials;
-
- // Create and load the XmlDocument.
- XmlDocument^ doc = gcnew XmlDocument;
- doc->XmlResolver = resolver; // Set the resolver.
- doc->Load( "book5.xml" );
-
- // Display the entity replacement text which is pulled from the DTD file.
- Console::WriteLine( doc->DocumentElement->LastChild->InnerText );
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp
deleted file mode 100644
index 1b175cb5e4e..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-public ref class Sample
-{
-private:
- static Boolean m_success = true;
-
-public:
- Sample()
- {
-
- // Validate the document using an external XSD schema. Validation should fail.
- Validate( "notValidXSD.xml" );
-
- // Validate the document using an inline XSD. Validation should succeed.
- Validate( "inlineXSD.xml" );
- }
-
-
-private:
-
- // Display the validation error.
- void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args )
- {
- m_success = false;
- Console::WriteLine( "\r\n\tValidation error: {0}", args->Message );
- }
-
- void Validate( String^ filename )
- {
- m_success = true;
- Console::WriteLine( "\r\n******" );
- Console::WriteLine( "Validating XML file {0}", filename );
- XmlTextReader^ txtreader = gcnew XmlTextReader( filename );
- XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader );
-
- // Set the validation event handler
- reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack );
-
- // Read XML data
- while ( reader->Read() )
- {}
-
- Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful!" : "failed.") );
-
- // Close the reader.
- reader->Close();
- }
-
-};
-
-int main()
-{
- Sample^ validation = gcnew Sample;
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp
deleted file mode 100644
index d4ffcecd285..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-//
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
-
- // Create the reader.
- XmlTextReader^ txtreader = gcnew XmlTextReader( "book4.xml" );
- XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader );
- reader->MoveToContent();
-
- // Display each of the attribute nodes, including default attributes.
- while ( reader->MoveToNextAttribute() )
- {
- if ( reader->IsDefault )
- Console::Write( "(default attribute) " );
-
- Console::WriteLine( " {0} = {1}", reader->Name, reader->Value );
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp
deleted file mode 100644
index 8704a0b66bd..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-using namespace System::Xml::Schema;
-
-public ref class Sample
-{
-private:
- static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args )
- {
- Console::WriteLine( "***Validation error" );
- Console::WriteLine( "\tSeverity: {0}", args->Severity );
- Console::WriteLine( "\tMessage : {0}", args->Message );
- }
-
-public:
- static void main()
- {
- XmlTextReader^ tr = gcnew XmlTextReader( "booksSchema.xml" );
- XmlValidatingReader^ vr = gcnew XmlValidatingReader( tr );
- vr->Schemas->Add( nullptr, "books.xsd" );
- vr->ValidationType = ValidationType::Schema;
- vr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack );
- while ( vr->Read() )
- {
- if ( vr->NodeType == XmlNodeType::Element )
- {
- if ( dynamic_cast(vr->SchemaType) != nullptr )
- {
- XmlSchemaComplexType^ sct = dynamic_cast(vr->SchemaType);
- Console::WriteLine( " {0}( {1})", vr->Name, sct->Name );
- }
- else
- {
- Object^ value = vr->ReadTypedValue();
- Console::WriteLine( " {0}( {1}): {2}", vr->Name, value->GetType()->Name, value );
- }
- }
- }
- }
-};
-
-int main()
-{
- Sample::main();
-}
-//
diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp
deleted file mode 100644
index c8b97c43ecc..00000000000
--- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Xml;
-int main()
-{
- array^args = Environment::GetCommandLineArgs();
- String^ UserName = args[ 1 ];
- String^ SecurelyStoredPassword = args[ 2 ];
- String^ Domain = args[ 3 ];
-
- //
- // Create the reader. ->
- XmlTextReader^ txtreader = gcnew XmlTextReader( "book5.xml" );
- XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader );
- txtreader->WhitespaceHandling = WhitespaceHandling::None;
-
- // Set the credentials necessary to access the DTD file stored on the network.
- XmlUrlResolver^ resolver = gcnew XmlUrlResolver;
- resolver->Credentials = System::Net::CredentialCache::DefaultCredentials;
- reader->XmlResolver = resolver;
-
- // Display each of the element nodes.
- while ( reader->Read() )
- {
- switch ( reader->NodeType )
- {
- case XmlNodeType::Element:
- Console::Write( "< {0}>", reader->Name );
- break;
-
- case XmlNodeType::Text:
- Console::Write( reader->Value );
- break;
-
- case XmlNodeType::DocumentType:
- Console::Write( "Name, reader->Value );
- break;
-
- case XmlNodeType::EntityReference:
- Console::Write( reader->Name );
- break;
-
- case XmlNodeType::EndElement:
- Console::Write( " {0}>", reader->Name );
- break;
- }
- }
-
-
- // Close the reader.
- reader->Close();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp
deleted file mode 100644
index 072abfddaab..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Net;
-using namespace System::Net::Http;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- void Method()
- {
- //
- Uri^ siteUri = gcnew Uri("http://www.contoso.com/");
-
- // HttpClient lifecycle management best practices:
- // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
- HttpClient^ client = gcnew HttpClient;
- HttpRequestMessage^ request = gcnew HttpRequestMessage(HttpMethod::Get, siteUri);
- HttpResponseMessage^ response = client->Send(request);
- //
- }
-};
-
-void main()
-{
- Form1^ f = gcnew Form1;
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp
deleted file mode 100644
index 1d511f22f6b..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- void Method()
- {
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
- Console::WriteLine( myUri->AbsolutePath );
- //
- }
-};
-
-void main()
-{
- Form1^ f = gcnew Form1;
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp
deleted file mode 100644
index f5adb1e6dc0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com" );
- Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
- Console::WriteLine( myUri->AbsoluteUri );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp
deleted file mode 100644
index 2cb8990b9d0..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" );
- Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" );
- Console::WriteLine( myUri->Authority );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp
deleted file mode 100644
index 0d5b9b87897..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Console::WriteLine( Uri::CheckHostName( "www.contoso.com" ) );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp
deleted file mode 100644
index db24745352e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" );
- Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" );
- Console::WriteLine( myUri->Host );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp
deleted file mode 100644
index 77b48ab3d82..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" );
-
- Console::WriteLine( myUri->PathAndQuery );
- //
-}
-
-void Method2()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" );
-
- Console::WriteLine( myUri->Query );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp
deleted file mode 100644
index 2298149c102..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
- Console::WriteLine( myUri->Port );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp
deleted file mode 100644
index 2a79562ae4c..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" );
- Console::WriteLine( myUri->Scheme );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp
deleted file mode 100644
index 1977347df49..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp
deleted file mode 100644
index 74ea933f0d1..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ myUri = gcnew Uri( "http://www.contoso.com/Hello%20World.htm",true );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp
deleted file mode 100644
index aa310799d84..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com" );
- Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm" );
- Console::WriteLine( myUri->ToString() );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp
deleted file mode 100644
index 1cd0cad6310..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-#using
-
-using namespace System;
-void main()
-{
- //
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
- Uri^ myUri = gcnew Uri( baseUri,"Hello%20World.htm",false );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp
deleted file mode 100644
index 7d57c1f31fb..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- UriBuilder^ uBuild = gcnew UriBuilder( "http://www.contoso.com/" );
- uBuild->Path = "index.htm";
- uBuild->Fragment = "main";
- Uri^ myUri = uBuild->Uri;
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp
deleted file mode 100644
index 8ed7f68ec92..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com" );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp
deleted file mode 100644
index af69e8f961a..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com",8080 );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp
deleted file mode 100644
index 6c6a09487e1..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm" );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp
deleted file mode 100644
index 3e0bf14858e..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::Security::Principal;
-using namespace System::Windows::Forms;
-
-void main()
-{
- //
- UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm","#top" );
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp
deleted file mode 100644
index fb120510b57..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
-// System::Net::HttpWebRequest::BeginGetResponse System::Net::HttpWebRequest::EndGetResponse
-/**
-* Snippet1, Snippet2, Snippet3 go together.
-* This program shows how to use BeginGetResponse and EndGetResponse methods of the
-* HttpWebRequest class.
-* It uses an asynchronous approach to get the response for the HTTP Web Request.
-* The RequestState class is defined to chekc the state of the request.
-* After a HttpWebRequest Object* is created, its BeginGetResponse method is used to start
-* the asynchronous response phase.
-* Finally, the EndGetResponse method is used to end the asynchronous response phase .
-*/
-#using
-
-using namespace System;
-using namespace System::Net;
-using namespace System::IO;
-using namespace System::Text;
-using namespace System::Threading;
-public ref class RequestState
-{
-private:
-
- // This class stores the State of the request.
- const int BUFFER_SIZE;
-
-public:
- StringBuilder^ requestData;
- array^BufferRead;
- HttpWebRequest^ request;
- HttpWebResponse^ response;
- Stream^ streamResponse;
- RequestState()
- : BUFFER_SIZE( 1024 )
- {
- BufferRead = gcnew array(BUFFER_SIZE);
- requestData = gcnew StringBuilder( "" );
- request = nullptr;
- streamResponse = nullptr;
- }
-
-};
-
-ref class HttpWebRequest_BeginGetResponse
-{
-public:
- static ManualResetEvent^ allDone = gcnew ManualResetEvent( false );
- static int BUFFER_SIZE = 1024;
-
- //
- //
- static void RespCallback( IAsyncResult^ asynchronousResult )
- {
- try
- {
-
- // State of request is asynchronous.
- RequestState^ myRequestState = dynamic_cast(asynchronousResult->AsyncState);
- HttpWebRequest^ myHttpWebRequest2 = myRequestState->request;
- myRequestState->response = dynamic_cast(myHttpWebRequest2->EndGetResponse( asynchronousResult ));
-
- // Read the response into a Stream object.
- Stream^ responseStream = myRequestState->response->GetResponseStream();
- myRequestState->streamResponse = responseStream;
-
- // Begin the Reading of the contents of the HTML page and print it to the console.
- IAsyncResult^ asynchronousInputRead = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState );
- }
- catch ( WebException^ e )
- {
- Console::WriteLine( "\nException raised!" );
- Console::WriteLine( "\nMessage: {0}", e->Message );
- Console::WriteLine( "\nStatus: {0}", e->Status );
- }
-
- }
-
- static void ReadCallBack( IAsyncResult^ asyncResult )
- {
- try
- {
- RequestState^ myRequestState = dynamic_cast(asyncResult->AsyncState);
- Stream^ responseStream = myRequestState->streamResponse;
- int read = responseStream->EndRead( asyncResult );
-
- // Read the HTML page and then print it to the console.
- if ( read > 0 )
- {
- myRequestState->requestData->Append( Encoding::ASCII->GetString( myRequestState->BufferRead, 0, read ) );
- IAsyncResult^ asynchronousResult = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState );
- }
- else
- {
- Console::WriteLine( "\nThe contents of the Html page are : " );
- if ( myRequestState->requestData->Length > 1 )
- {
- String^ stringContent;
- stringContent = myRequestState->requestData->ToString();
- Console::WriteLine( stringContent );
- }
- Console::WriteLine( "Press any key to continue.........." );
- Console::ReadLine();
- responseStream->Close();
- allDone->Set();
- }
- }
- catch ( WebException^ e )
- {
- Console::WriteLine( "\nException raised!" );
- Console::WriteLine( "\nMessage: {0}", e->Message );
- Console::WriteLine( "\nStatus: {0}", e->Status );
- }
-
- }
-
-};
-
-int main()
-{
- try
- {
-
- // Create a HttpWebrequest object to the desired URL.
- HttpWebRequest^ myHttpWebRequest1 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" ));
-
- // Create an instance of the RequestState and assign the previous myHttpWebRequest1
- // object to its request field.
- RequestState^ myRequestState = gcnew RequestState;
- myRequestState->request = myHttpWebRequest1;
-
- // Start the asynchronous request.
- IAsyncResult^ result = dynamic_cast(myHttpWebRequest1->BeginGetResponse( gcnew AsyncCallback( HttpWebRequest_BeginGetResponse::RespCallback ), myRequestState ));
- HttpWebRequest_BeginGetResponse::allDone->WaitOne();
-
- // Release the HttpWebResponse resource.
- myRequestState->response->Close();
- }
- catch ( WebException^ e )
- {
- Console::WriteLine( "\nException raised!" );
- Console::WriteLine( "\nMessage: {0}", e->Message );
- Console::WriteLine( "\nStatus: {0}", e->Status );
- Console::WriteLine( "Press any key to continue.........." );
- }
- catch ( Exception^ e )
- {
- Console::WriteLine( "\nException raised!" );
- Console::WriteLine( "Source : {0} ", e->Source );
- Console::WriteLine( "Message : {0} ", e->Message );
- Console::WriteLine( "Press any key to continue.........." );
- Console::Read();
- }
-
-}
-
-//
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp
deleted file mode 100644
index 7dc16c6e6be..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-#using
-
-using namespace System;
-using namespace System::Net;
-using namespace System::Text;
-using namespace System::Threading;
-
-// TryCreate
-void SampleTryCreate()
-{
- //
- // String to parse.
- String^ addressString = "catalog/shownew.htm?date=today";
-
- // Parse the string and create a new Uri instance, if possible.
- Uri^ result;
- if ( Uri::TryCreate( addressString, UriKind::RelativeOrAbsolute, result ) )
- {
- // The call was successful. Write the URI address to the console.
- Console::Write( result );
-
- // Check whether new Uri instance is absolute or relative.
- if ( result->IsAbsoluteUri )
- Console::WriteLine( " is an absolute Uri." );
- else
- Console::WriteLine( " is a relative Uri." );
- }
- else
- {
- // Let the user know that the call failed.
- Console::WriteLine( "addressString could not be parsed as a URI address." );
- }
- //
-}
-
-// Constructor
-void SampleConstructor()
-{
- //
- // Create an absolute Uri from a string.
- String^ addressString1 = "http://www.contoso.com/";
- String^ addressString2 = "catalog/shownew.htm?date=today";
- Uri^ absoluteUri = gcnew Uri(addressString1);
-
- // Create a relative Uri from a string. allowRelative = true to allow for
- // creating a relative Uri.
- Uri^ relativeUri = gcnew Uri(addressString2);
-
- // Check whether the new Uri is absolute or relative.
- if ( !relativeUri->IsAbsoluteUri )
- Console::WriteLine( "{0} is a relative Uri.", relativeUri );
-
- // Create a new Uri from an absolute Uri and a relative Uri.
- Uri^ combinedUri = gcnew Uri( absoluteUri,relativeUri );
- Console::WriteLine( combinedUri->AbsoluteUri );
- //
-}
-
-// OriginalString
-void SampleOriginalString()
-{
- //
- // Create a new Uri from a string address.
- Uri^ uriAddress = gcnew Uri( "HTTP://www.ConToso.com:80//thick%20and%20thin.htm" );
-
- // Write the new Uri to the console and note the difference in the two values.
- // ToString() gives the canonical version. OriginalString gives the original
- // string that was passed to the constructor.
- // The following outputs "http://www.contoso.com//thick and thin.htm".
- Console::WriteLine( uriAddress );
-
- // The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm".
- Console::WriteLine( uriAddress->OriginalString );
- //
-}
-
-
-// DNSSafeHost
-void SampleDNSSafeHost()
-{
- //
- // Create new Uri using a string address.
- Uri^ address = gcnew Uri( "http://[fe80::200:39ff:fe36:1a2d%254]/temp/example.htm" );
-
- // Make the address DNS safe.
- // The following outputs "[fe80::200:39ff:fe36:1a2d]".
- Console::WriteLine( address->Host );
-
- // The following outputs "fe80::200:39ff:fe36:1a2d%254".
- Console::WriteLine( address->DnsSafeHost );
- //
-}
-
-// operator == and !==
-void SampleOperatorEqual()
-{
- //
- // Create some Uris.
- Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" );
- Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" );
- Uri^ address3 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" );
-
- // The first two are equal because the fragment is ignored.
- if ( address1 == address2 )
- Console::WriteLine( "{0} is equal to {1}", address1, address2 );
-
- // The second two are not equal.
- if ( address2 != address3 )
- Console::WriteLine( "{0} is not equal to {1}", address2, address3 );
- //
-}
-
-// IsBaseOf
-void SampleIsBaseOf()
-{
- //
- // Create a base Uri.
- Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" );
-
- // Create a new Uri from a string.
- Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm?date=today" );
-
- // Determine whether BaseUri is a base of UriAddress.
- if ( baseUri->IsBaseOf( uriAddress ) )
- Console::WriteLine( "{0} is the base of {1}", baseUri, uriAddress );
- //
-}
-
-int main()
-{
- // TryParse
- SampleTryCreate();
-
- // Constructor
- SampleConstructor();
-
- // OriginalString
- SampleOriginalString();
-
- // DNSSafeHost
- SampleDNSSafeHost();
-
- // operator == and !==
- SampleOperatorEqual();
-
- // IsBaseOf
- SampleIsBaseOf();
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp
deleted file mode 100644
index f7f450b51de..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-#using
-
-using namespace System;
-using namespace System::Net;
-using namespace System::Text;
-using namespace System::Threading;
-using namespace System::Runtime::Serialization;
-
-namespace Example
-{
- public ref class Test
- {
- public:
- static void Main()
- {
- // Snippets 1 and 2
- HexConversions();
-
- // snippet 7
- SampleToString();
-
- // snippet 8
- SampleEquals();
-
- // snippets 4, 5, and 6
- GetParts();
-
- // snippet 3
- SampleMakeRelative();
-
- // snippets 9 - 17
- SampleCheckSchemeName();
-
- // snippets 18
- SampleUserInfo();
- }
-
- private:
- static void SampleToString()
- {
- //
- // Create a new Uri from a string address.
- Uri^ uriAddress = gcnew Uri( "HTTP://www.Contoso.com:80/thick%20and%20thin.htm" );
-
- // Write the new Uri to the console and note the difference in the two values.
- // ToString() gives the canonical version. OriginalString gives the orginal
- // string that was passed to the constructor.
- // The following outputs "http://www.contoso.com/thick and thin.htm".
- Console::WriteLine( uriAddress );
-
- // The following outputs "HTTP://www.Contoso.com:80/thick%20and%20thin.htm".
- Console::WriteLine( uriAddress->OriginalString );
- //
- }
-
- static void SampleEquals()
- {
- //
- // Create some Uris.
- Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" );
- Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" );
- if ( address1->Equals( address2 ) )
- {
- Console::WriteLine( "The two addresses are equal" );
- }
- else
- {
- Console::WriteLine( "The two addresses are not equal" );
- }
- // Will output "The two addresses are equal"
- //
- }
-
- static void GetParts()
- {
- //
- // Create Uri
- Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm#search" );
- Console::WriteLine( uriAddress->Fragment );
- Console::WriteLine( "Uri {0} the default port ", uriAddress->IsDefaultPort ? (String^)"uses" : "does not use" );
-
- Console::WriteLine( "The path of this Uri is {0}", uriAddress->GetLeftPart( UriPartial::Path ) );
- Console::WriteLine( "Hash code {0}", uriAddress->GetHashCode() );
- // The example displays output similar to the following:
- // #search
- // Uri uses the default port
- // The path of this Uri is http://www.contoso.com/index.htm
- // Hash code -988419291
- //
-
- //
- Uri^ uriAddress1 = gcnew Uri( "http://www.contoso.com/title/index.htm" );
- Console::WriteLine( "The parts are {0}, {1}, {2}", uriAddress1->Segments[ 0 ], uriAddress1->Segments[ 1 ], uriAddress1->Segments[ 2 ] );
- //
-
- //
- Uri^ uriAddress2 = gcnew Uri( "file://server/filename.ext" );
- Console::WriteLine( uriAddress2->LocalPath );
- Console::WriteLine( "Uri {0} a UNC path", uriAddress2->IsUnc ? (String^)"is" : "is not" );
- Console::WriteLine( "Uri {0} a local host", uriAddress2->IsLoopback ? (String^)"is" : "is not" );
- Console::WriteLine( "Uri {0} a file", uriAddress2->IsFile ? (String^)"is" : "is not" );
- // The example displays the following output:
- // \\server\filename.ext
- // Uri is a UNC path
- // Uri is not a local host
- // Uri is a file
- //
- }
-
- static void HexConversions()
- {
-
- //
- char testChar = 'e';
- if ( Uri::IsHexDigit( testChar ) )
- {
- Console::WriteLine( "'{0}' is the hexadecimal representation of {1}",
- testChar, Uri::FromHex( testChar ) );
- }
- else
- {
- Console::WriteLine( "'{0}' is not a hex character", testChar );
- }
-
- String^ returnString = Uri::HexEscape( testChar );
- Console::WriteLine( "The hexadecimal value of '{0}' is {1}", testChar, returnString );
- //
-
- //
- String^ testString = "%75";
- int index = 0;
- if ( Uri::IsHexEncoding( testString, index ) )
- {
- Console::WriteLine( "The character is {0}",
- Uri::HexUnescape( testString, index ) );
- }
- else
- {
- Console::WriteLine( "The character is not hex encoded" );
- }
- //
- }
-
- // MakeRelative
- static void SampleMakeRelative()
- {
- //
- // Create a base Uri.
- Uri^ address1 = gcnew Uri( "http://www.contoso.com/" );
-
- // Create a new Uri from a string.
- Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" );
-
- // Determine the relative Uri.
- Console::WriteLine( "The difference is {0}", address1->MakeRelativeUri( address2 ) );
- //
- }
-
- //CheckSchemeName
- static void SampleCheckSchemeName()
- {
- //
- Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" );
- Console::WriteLine( "address 1 {0} a valid scheme name",
- Uri::CheckSchemeName( address1->Scheme ) ? (String^)" has" : " does not have" );
- if ( address1->Scheme == Uri::UriSchemeHttp )
- {
- Console::WriteLine( "Uri is HTTP type" );
- }
-
- Console::WriteLine( address1->HostNameType );
- //
-
- //
- Uri^ address2 = gcnew Uri( "file://server/filename.ext" );
- if ( address2->Scheme == Uri::UriSchemeFile )
- {
- Console::WriteLine( "Uri is a file" );
- }
- //
-
- Console::WriteLine( address2->HostNameType );
-
- //
- Uri^ address3 = gcnew Uri( "mailto:user@contoso.com?subject=uri" );
- if ( address3->Scheme == Uri::UriSchemeMailto )
- {
- Console::WriteLine( "Uri is an email address" );
- }
- //
-
- //
- Uri^ address4 = gcnew Uri( "news:123456@contoso.com" );
- if ( address4->Scheme == Uri::UriSchemeNews )
- {
- Console::WriteLine( "Uri is an Internet news group" );
- }
- //
-
- //
- Uri^ address5 = gcnew Uri( "nntp://news.contoso.com/123456@contoso.com" );
- if ( address5->Scheme == Uri::UriSchemeNntp )
- {
- Console::WriteLine( "Uri is nntp protocol" );
- }
- //
-
- //
- Uri^ address6 = gcnew Uri( "gopher://example.contoso.com/" );
- if ( address6->Scheme == Uri::UriSchemeGopher )
- {
- Console::WriteLine( "Uri is Gopher protocol" );
- }
- //
-
- //
- Uri^ address7 = gcnew Uri( "ftp://contoso/files/testfile.txt" );
- if ( address7->Scheme == Uri::UriSchemeFtp )
- {
- Console::WriteLine( "Uri is Ftp protocol" );
- }
- //
-
- //
- Uri^ address8 = gcnew Uri( "https://example.contoso.com" );
- if ( address8->Scheme == Uri::UriSchemeHttps )
- {
- Console::WriteLine( "Uri is Https protocol." );
- }
- //
-
- //
- String^ address = "www.contoso.com";
- String^ uriString = String::Format( "{0}{1}{2}",
- Uri::UriSchemeHttp, Uri::SchemeDelimiter, address );
-
-#if OLDMETHOD
- Uri^ result;
- if ( Uri::TryParse( uriString, false, false, result ) )
- {
- Console::WriteLine( "{0} is a valid Uri", result );
- }
- else
- {
- Console::WriteLine( "Uri not created" );
- }
-#endif
- Uri ^result = gcnew Uri(uriString);
- if (result->IsWellFormedOriginalString())
- Console::WriteLine("{0} is a well formed Uri", uriString);
- else
- Console::WriteLine("{0} is not a well formed Uri", uriString);
- //
- }
-
- static void SampleUserInfo()
- {
- //
- Uri^ uriAddress = gcnew Uri( "http://user:password@www.contoso.com/index.htm " );
- Console::WriteLine( uriAddress->UserInfo );
- Console::WriteLine( "Fully Escaped {0}",
- uriAddress->UserEscaped ? (String^)"yes" : "no" );
- //
- }
- };
-}
-
-int main()
-{
- Example::Test::Main();
-}
diff --git a/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp b/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp
deleted file mode 100644
index c2507006a55..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-//
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::IO;
-using namespace System::Runtime::Serialization::Formatters::Soap;
-
-// A test object that needs to be serialized.
-
-[Serializable]
-ref class TestSimpleObject
-{
-private:
- int member1;
- String^ member2;
- String^ member3;
- double member4;
-
-public:
-
- // A field that is not serialized.
-
- [NonSerialized]
- String^ member5;
- TestSimpleObject()
- {
- member1 = 11;
- member2 = "hello";
- member3 = "hello";
- member4 = 3.14159265;
- member5 = "hello world!";
- }
-
- void Print()
- {
- Console::WriteLine( "member1 = ' {0}'", member1 );
- Console::WriteLine( "member2 = ' {0}'", member2 );
- Console::WriteLine( "member3 = ' {0}'", member3 );
- Console::WriteLine( "member4 = ' {0}'", member4 );
- Console::WriteLine( "member5 = ' {0}'", member5 );
- }
-
-};
-
-int main()
-{
- // Creates a new TestSimpleObject object.
- TestSimpleObject^ obj = gcnew TestSimpleObject;
- Console::WriteLine( "Before serialization the Object* contains: " );
- obj->Print();
-
- // Opens a file and serializes the object into it in binary format.
- Stream^ stream = File::Open( "data.xml", FileMode::Create );
- SoapFormatter^ formatter = gcnew SoapFormatter;
-
- formatter->Serialize( stream, obj );
- stream->Close();
-
- // Empties obj.
- obj = nullptr;
-
- // Opens file S"data.xml" and deserializes the object from it.
- stream = File::Open( "data.xml", FileMode::Open );
- formatter = gcnew SoapFormatter;
-
- obj = dynamic_cast(formatter->Deserialize( stream ));
- stream->Close();
- Console::WriteLine( "" );
- Console::WriteLine( "After deserialization the object contains: " );
- obj->Print();
-}
-
-//
diff --git a/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp b/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp
deleted file mode 100644
index dbc94df5f39..00000000000
--- a/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#using
-#pragma region^ Using directives
-
-using namespace System;
-using namespace System::Collections::Generic;
-using namespace System::Text;
-
-#pragma endregion
-
-int main()
-{
- //
- UriBuilder^ baseUri = gcnew UriBuilder
- ("http://www.contoso.com/default.aspx?Param1=7890");
- String^ queryToAppend = "param2=1234";
- if (baseUri->Query != nullptr && baseUri->Query->Length > 1)
- {
- // Note: In .NET Core and .NET 5+, you can simplify by removing
- // the call to Substring(), which removes the leading "?" character.
- baseUri->Query = baseUri->Query->Substring(1)+ "&" + queryToAppend;
- }
- else
- {
- baseUri->Query = queryToAppend;
- }
- //
-}
diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp
deleted file mode 100644
index 261eb1e694e..00000000000
--- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
- //
-public:
- [RecommendedAsConfigurable(true)]
- property int MyProperty
- {
- int get()
- {
- // Insert code here.
- return 0;
- }
- void set( int /*value*/ )
- {
- // Insert code here.
- }
- }
- //
- void Method1()
- {
- //
- // Gets the attributes for the property.
- AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;
-
- // Checks to see if the value of the RecommendedAsConfigurableAttribute is Yes.
- if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) )
- {
- // Insert code here.
- }
-
- // This is another way to see if the property is recommended as configurable.
- RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]);
- if ( myAttribute->RecommendedAsConfigurable )
- {
- // Insert code here.
- }
- //
- }
-
- void Method2()
- {
- //
- AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty );
- if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) )
- {
- // Insert code here.
- }
- //
- }
-};
-
-/*
-This code produces the following output.
-
-myQ is not synchronized.
-mySyncdQ is synchronized.
-*/
diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp
deleted file mode 100644
index daaf00fa8cb..00000000000
--- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- TextBox^ textBox1;
-
-public:
- void Method()
- {
- //
- // Gets the attributes for the property.
- AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes;
-
- // Checks to see if the property is recommended as configurable.
- RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]);
- if ( myAttribute->RecommendedAsConfigurable )
- {
- // Insert code here.
- }
- //
- }
-};
-
-/*
-This code produces the following output.
-
-myQ is not synchronized.
-mySyncdQ is synchronized.
-*/
diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp
deleted file mode 100644
index 7b9aaf400ee..00000000000
--- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#using
-#using
-#using
-#using
-
-using namespace System;
-using namespace System::Data;
-using namespace System::ComponentModel;
-using namespace System::Windows::Forms;
-
-public ref class Form1: public Form
-{
-protected:
- TextBox^ textBox1;
-
-
- //
-public:
- [RecommendedAsConfigurable(true)]
- property int MyProperty
- {
- int get()
- {
- // Insert code here.
- return 0;
- }
- void set( int value )
- {
-
- // Insert code here.
- }
- }
- //
-};
diff --git a/xml/System.Numerics/BigInteger.xml b/xml/System.Numerics/BigInteger.xml
index 07e24014d96..3761217f3b7 100644
--- a/xml/System.Numerics/BigInteger.xml
+++ b/xml/System.Numerics/BigInteger.xml
@@ -1827,7 +1827,6 @@ The individual bytes in the `value` array should be in little-endian order, from
## Examples
The following example instantiates a object from each integral type except . It then calls the method to compare the value with the original integer value that was passed to the constructor. As the output shows, the values are equal in each case.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System.Numerics/BigInteger/Equals/EqualsExample1.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet1":::
@@ -1894,7 +1893,6 @@ The individual bytes in the `value` array should be in little-endian order, from
## Examples
The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Numerics/BigInteger/Equals/EqualsExample1.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
@@ -2033,7 +2031,6 @@ The individual bytes in the `value` array should be in little-endian order, from
## Examples
The following example compares the approximate distance of several stars from Earth with the distance of Epsilon Indi from Earth to determine whether they are equal. The example uses each overload of the method to test for equality.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Numerics/BigInteger/Equals/EqualsExample1.cs" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System.Numerics/BigInteger/Equals/EqualsExample1.fs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/vb/EqualsExample1.vb" id="Snippet2":::
diff --git a/xml/System.Reflection.Emit/AssemblyBuilder.xml b/xml/System.Reflection.Emit/AssemblyBuilder.xml
index f1cce090757..07e99e27bfe 100644
--- a/xml/System.Reflection.Emit/AssemblyBuilder.xml
+++ b/xml/System.Reflection.Emit/AssemblyBuilder.xml
@@ -89,7 +89,6 @@ For more information about this API, see [Supplemental API remarks for AssemblyB
method to get a resource writer. The example uses the resource writer to add three resource strings.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/DefineResource/assemblybuilder_defineresource.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/VB/assemblybuilder_defineresource.vb" id="Snippet1":::
@@ -1157,7 +1149,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The following code sample creates and attaches an array of bytes representing an unmanaged resource to a dynamic assembly, using `DefineUnmanagedResource`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/DefineUnmanagedResource/assemblybuilder_defineunmanagedresource2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/VB/assemblybuilder_defineunmanagedresource2.vb" id="Snippet1":::
@@ -1218,7 +1209,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The example below demonstrates a call to `DefineUnmanagedResource`, passing an external resource file.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/DefineUnmanagedResource/assemblybuilder_defineunmanagedresource.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/VB/assemblybuilder_defineunmanagedresource.vb" id="Snippet3":::
@@ -1298,7 +1288,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The example below illustrates the usage of `DefineVersionInfoResource`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection/AssemblyCompanyAttribute/Overview/assemblybuilder_defineversioninforesource.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/VB/assemblybuilder_defineversioninforesource.vb" id="Snippet1":::
@@ -1367,7 +1356,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The example below illustrates the usage of `DefineVersionInfoResource`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection/AssemblyCompanyAttribute/Overview/assemblybuilder_defineversioninforesource.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/VB/assemblybuilder_defineversioninforesource.vb" id="Snippet1":::
@@ -3164,7 +3152,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The following code sample creates a dynamic assembly and then persists it to a local disk using `Save`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/Save/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/VB/source.vb" id="Snippet1":::
@@ -3386,7 +3373,6 @@ The following code example shows how to define and use a dynamic assembly. The e
## Examples
The following code sample illustrates the use of `SetCustomAttribute` within , using a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/SetCustomAttribute/assemblybuilder_setcustomattribute1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/VB/assemblybuilder_setcustomattribute1.vb" id="Snippet1":::
@@ -3470,7 +3456,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code sample illustrates the use of `SetCustomAttribute` to attach a custom attribute to a dynamically generated assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/AssemblyBuilder/SetCustomAttribute/assemblybuilder_setcustomattribute2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/VB/assemblybuilder_setcustomattribute2.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/ConstructorBuilder.xml b/xml/System.Reflection.Emit/ConstructorBuilder.xml
index 5bbb76a62da..c49bcc051f3 100644
--- a/xml/System.Reflection.Emit/ConstructorBuilder.xml
+++ b/xml/System.Reflection.Emit/ConstructorBuilder.xml
@@ -93,7 +93,6 @@
## Examples
The following code sample illustrates the contextual usage of a `ConstructorBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/VB/source.vb" id="Snippet1":::
@@ -178,7 +177,6 @@
## Examples
The following code sample illustrates the use of `AddDeclarativeSecurity`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/VB/constructorbuilder_attributes_4.vb" id="Snippet1":::
@@ -239,7 +237,6 @@
## Remarks
The following code sample illustrates the use of `Attributes`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/VB/constructorbuilder_attributes_4.vb" id="Snippet2":::
@@ -341,7 +338,6 @@
The following code sample illustrates the use of `DeclaringType`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/AddDeclarativeSecurity/constructorbuilder_attributes_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/VB/constructorbuilder_attributes_4.vb" id="Snippet2":::
@@ -632,7 +628,6 @@
## Examples
The following code sample illustrates the use of the `GetILGenerator` method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/VB/source.vb" id="Snippet1":::
@@ -776,7 +771,6 @@
## Remarks
The following code sample illustrates the use of `GetMethodImplementationFlags`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection/MethodBase/GetMethodImplementationFlags/constructorbuilder_getmodule_4.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/VB/constructorbuilder_getmodule_4.vb" id="Snippet3":::
@@ -818,7 +812,6 @@
## Remarks
The following code sample illustrates the usage of `GetModule`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/GetModule/source3.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/VB/source3.vb" id="Snippet1":::
@@ -876,7 +869,6 @@
## Examples
The code sample illustrates the use of `GetParameters`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection/MethodBase/GetMethodImplementationFlags/constructorbuilder_getmodule_4.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/VB/constructorbuilder_getmodule_4.vb" id="Snippet4":::
@@ -922,7 +914,6 @@
## Remarks
This code sample illustrates the use of `GetToken`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection/MethodBase/GetMethodImplementationFlags/constructorbuilder_getmodule_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/VB/constructorbuilder_getmodule_4.vb" id="Snippet2":::
@@ -1410,7 +1401,6 @@
## Remarks
The following code sample illustrates the use of `Name`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/Name/constructorbuilder_name_5.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_Name_5/VB/constructorbuilder_name_5.vb" id="Snippet2":::
@@ -1573,7 +1563,6 @@
## Examples
The following code sample illustrates the use of `SetCustomAttribute` of the context of a , passing a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetCustomAttribute/constructorbuilder_setcustomattribute1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/VB/constructorbuilder_setcustomattribute1.vb" id="Snippet1":::
@@ -1648,7 +1637,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code sample illustrates the use of `SetCustomAttribute` of the context of a , passing a byte blob.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetCustomAttribute/constructorbuilder_setcustomattribute2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/VB/constructorbuilder_setcustomattribute2.vb" id="Snippet1":::
@@ -1743,7 +1731,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Remarks
The following code sample illustrates the use of `SetImplementationFlags`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetImplementationFlags/constructorbuilder_setimplementationflags.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/VB/constructorbuilder_setimplementationflags.vb" id="Snippet1":::
@@ -1874,7 +1861,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Remarks
The following code sample illustrates the use of `SetSymCustomAttributes`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/SetSymCustomAttribute/constructorbuilder_setsymcustomattribute.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/VB/constructorbuilder_setsymcustomattribute.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/CustomAttributeBuilder.xml b/xml/System.Reflection.Emit/CustomAttributeBuilder.xml
index cb03f3db954..db197f59b00 100644
--- a/xml/System.Reflection.Emit/CustomAttributeBuilder.xml
+++ b/xml/System.Reflection.Emit/CustomAttributeBuilder.xml
@@ -81,7 +81,6 @@
## Examples
The following code sample illustrates the use of `CustomAttributeBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/CustomAttributeBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/VB/source.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/DynamicMethod.xml b/xml/System.Reflection.Emit/DynamicMethod.xml
index 3db6a665d24..c455da29cdf 100644
--- a/xml/System.Reflection.Emit/DynamicMethod.xml
+++ b/xml/System.Reflection.Emit/DynamicMethod.xml
@@ -57,7 +57,6 @@
method.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet1":::
]]>
@@ -361,7 +360,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example creates a dynamic method that takes two parameters. The example emits a simple function body that prints the first parameter to the console, and the example uses the second parameter as the return value of the method. The example completes the method by creating a delegate, invokes the delegate with different parameters, and finally invokes the dynamic method using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/VB/source.vb" id="Snippet1":::
@@ -978,7 +976,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the method attributes of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet21":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet21":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet21":::
@@ -1034,7 +1031,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the calling convention of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet22":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet22":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet22":::
@@ -1121,7 +1117,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example creates a dynamic method that takes two parameters. The example emits a simple function body that prints the first parameter to the console, and the example uses the second parameter as the return value of the method. The example completes the method by creating a delegate, invokes the delegate with different parameters, and finally invokes the dynamic method using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/VB/source.vb" id="Snippet1":::
@@ -1299,7 +1294,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the declaring type of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet23":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet23":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet23":::
@@ -1365,7 +1359,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example shows how to define parameter information for a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet33":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet33":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet33":::
@@ -1671,7 +1664,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example creates a dynamic method that takes two parameters. The example emits a simple function body that prints the first parameter to the console, and the example uses the second parameter as the return value of the method. The example completes the method by creating a delegate, invokes the delegate with different parameters, and finally invokes the dynamic method using the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/.ctor/source1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/VB/source.vb" id="Snippet1":::
@@ -1741,7 +1733,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example demonstrates this method overload. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet2":::
@@ -1847,7 +1838,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the parameters of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet34":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet34":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet34":::
@@ -1905,7 +1895,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the property of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet24":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet24":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet24":::
@@ -1991,7 +1980,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example invokes a dynamic method with exact binding, using the US-English culture. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet4":::
@@ -2443,7 +2431,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the property of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet26":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet26":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet26":::
@@ -2501,7 +2488,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the name of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet27":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet27":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet27":::
@@ -2564,7 +2550,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the reflected type of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet28":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet28":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet28":::
@@ -2667,7 +2652,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the return type of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet30":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet30":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet30":::
@@ -2723,7 +2707,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example shows how to display the custom attributes of the return type of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet31":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet31":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet31":::
@@ -2781,7 +2764,6 @@ The following code example creates a dynamic method that takes two parameters. T
## Examples
The following code example displays the method of a dynamic method. This code example is part of a larger example provided for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp" id="Snippet32":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/DynamicMethod/Overview/source.cs" id="Snippet32":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Reflection.DynamicMethod.All/VB/source.vb" id="Snippet32":::
diff --git a/xml/System.Reflection.Emit/EnumBuilder.xml b/xml/System.Reflection.Emit/EnumBuilder.xml
index 35e5c672a7f..16e5034413c 100644
--- a/xml/System.Reflection.Emit/EnumBuilder.xml
+++ b/xml/System.Reflection.Emit/EnumBuilder.xml
@@ -101,7 +101,6 @@
> [!NOTE]
> Prior to the .NET Framework version 2.0, this code example does not produce a correct enumeration.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Overview/modulebuilder_defineenum.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineEnum/VB/modulebuilder_defineenum.vb" id="Snippet1":::
@@ -179,7 +178,6 @@
## Examples
The following code sample demonstrates the use of the `Assembly` property to reference the parent assembly of the current `EnumBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Assembly/enumbuilder_properties_5.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_Properties_5/VB/enumbuilder_properties_5.vb" id="Snippet1":::
@@ -245,7 +243,6 @@ See for a description of the format of the
@@ -628,7 +625,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
> [!NOTE]
> Prior to the .NET Framework version 2.0, this code example does not produce a correct enumeration.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Overview/modulebuilder_defineenum.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineEnum/VB/modulebuilder_defineenum.vb" id="Snippet1":::
@@ -1084,7 +1080,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
The following code sample illustrates the use of `GetCustomAttribute` in the context of .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/GetCustomAttributes/enumbuilder_setcustomattribute2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/VB/enumbuilder_setcustomattribute2.vb" id="Snippet1":::
@@ -1145,7 +1140,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
The following code sample illustrates the use of `GetCustomAttribute` in the context of .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/GetCustomAttributes/enumbuilder_setcustomattribute1.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/VB/enumbuilder_setcustomattribute1.vb" id="Snippet2":::
@@ -2409,7 +2403,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
## Examples
The following code sample demonstrates the use of the `GUID` property to reference the associated of the current `EnumBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/GUID/enumbuilder_properties_4.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/VB/enumbuilder_properties_4.vb" id="Snippet4":::
@@ -3496,7 +3489,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
## Examples
The following code sample demonstrates the use of the `Module` property to reference the parent module of the current `EnumBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Assembly/enumbuilder_properties_5.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_Properties_5/VB/enumbuilder_properties_5.vb" id="Snippet3":::
@@ -3548,7 +3540,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
## Examples
The following code sample demonstrates the use of the `Name` property to reference the name of the current `EnumBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp" id="Snippet4":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Assembly/enumbuilder_properties_5.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_Properties_5/VB/enumbuilder_properties_5.vb" id="Snippet4":::
@@ -3607,7 +3598,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
## Examples
The following code sample demonstrates the use of the `Namespace` property to reference the associated namespace of the current `EnumBuilder`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Assembly/enumbuilder_properties_5.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_Properties_5/VB/enumbuilder_properties_5.vb" id="Snippet5":::
@@ -3720,7 +3710,6 @@ The following code sample demonstrates the use of the `AssemblyQualifiedName` pr
## Examples
The following code sample illustrates the use of `SetCustomAttribute` in the context of , passing a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/GetCustomAttributes/enumbuilder_setcustomattribute2.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/VB/enumbuilder_setcustomattribute2.vb" id="Snippet2":::
@@ -3795,7 +3784,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code sample illustrates the use of `SetCustomAttribute` in the context of , passing a byte blob.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/GetCustomAttributes/enumbuilder_setcustomattribute2.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/VB/enumbuilder_setcustomattribute2.vb" id="Snippet2":::
diff --git a/xml/System.Reflection.Emit/FieldBuilder.xml b/xml/System.Reflection.Emit/FieldBuilder.xml
index 58d40f419ed..827940ee522 100644
--- a/xml/System.Reflection.Emit/FieldBuilder.xml
+++ b/xml/System.Reflection.Emit/FieldBuilder.xml
@@ -165,7 +165,6 @@
## Remarks
The following code sample illustrates the use of `Attributes`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/Attributes/fieldbuilder_reflectedtype.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_ReflectedType/VB/fieldbuilder_reflectedtype.vb" id="Snippet1":::
@@ -727,7 +726,6 @@
The following code sample illustrates the use of `ReflectedType`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/Attributes/fieldbuilder_reflectedtype.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_ReflectedType/VB/fieldbuilder_reflectedtype.vb" id="Snippet1":::
@@ -895,7 +893,6 @@
## Examples
The following code sample illustrates the use of `SetCustomAttribute` in the context of , using a .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/SetCustomAttribute/fieldbuilder_setcustomattributes.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/VB/fieldbuilder_setcustomattributes.vb" id="Snippet1":::
@@ -971,7 +968,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code sample illustrates the use of `SetCustomAttribute` in the context of , using a byte blob.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/SetCustomAttribute/fieldbuilder_setcustomattributes.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/VB/fieldbuilder_setcustomattributes.vb" id="Snippet1":::
@@ -1065,7 +1061,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Remarks
The following code sample illustrates the use of `SetMarshal`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/SetMarshal/fieldbuilder_setoffset.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_SetOffset/VB/fieldbuilder_setoffset.vb" id="Snippet1":::
@@ -1129,7 +1124,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Remarks
The following code sample illustrates the use of `SetOffset`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/FieldBuilder/SetMarshal/fieldbuilder_setoffset.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/FieldBuilder_SetOffset/VB/fieldbuilder_setoffset.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/GenericTypeParameterBuilder.xml b/xml/System.Reflection.Emit/GenericTypeParameterBuilder.xml
index 432ae0f28f0..fbd9e0a585d 100644
--- a/xml/System.Reflection.Emit/GenericTypeParameterBuilder.xml
+++ b/xml/System.Reflection.Emit/GenericTypeParameterBuilder.xml
@@ -81,7 +81,6 @@
## Examples
The following code example creates a generic type with two type parameters, and saves them in the assembly GenericEmitExample1.dll. You can use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to view the generated types. For a more detailed explanation of the steps involved in defining a dynamic generic type, see [How to: Define a Generic Type with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-type-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EmitGenericType/VB/source.vb" id="Snippet1":::
@@ -3309,7 +3308,6 @@
## Examples
The following code example creates a dynamic module, an abstract generic type named `Sample` with one type parameter, `T`, and an abstract method named `TestMethod`. `TestMethod` takes a `ref` parameter (`ByRef` in Visual Basic) of type `T`, a pointer to type `T`, and an array of `T`. This method returns a two-dimensional array of `T`. The code example saves the dynamic module to disk, so you can examine it using the MSIL Disassembler (Ildasm.exe).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/MakeArrayType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/VB/source.vb" id="Snippet1":::
@@ -3377,7 +3375,6 @@
## Examples
The following code example creates a dynamic module, an abstract generic type named `Sample` with one type parameter, `T`, and an abstract method named `TestMethod`. `TestMethod` takes a `ref` parameter (`ByRef` in Visual Basic) of type `T`, a pointer to type `T`, and an array of `T`. This method returns a two-dimensional array of `T`. The code example saves the dynamic module to disk, so you can examine it using the MSIL Disassembler (Ildasm.exe).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/MakeArrayType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/VB/source.vb" id="Snippet1":::
@@ -3438,7 +3435,6 @@
## Examples
The following code example creates a dynamic module, an abstract generic type named `Sample` with one type parameter, `T`, and an abstract method named `TestMethod`. `TestMethod` takes a `ref` parameter (`ByRef` in Visual Basic) of type `T`, a pointer to type `T`, and an array of `T`. This method returns a two-dimensional array of `T`. The code example saves the dynamic module to disk, so you can examine it using the MSIL Disassembler (Ildasm.exe).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/MakeArrayType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/VB/source.vb" id="Snippet1":::
@@ -3559,7 +3555,6 @@
## Examples
The following code example creates a dynamic module, an abstract generic type named `Sample` with one type parameter, `T`, and an abstract method named `TestMethod`. `TestMethod` takes a `ref` parameter (`ByRef` in Visual Basic) of type `T`, a pointer to type `T`, and an array of `T`. This method returns a two-dimensional array of `T`. The code example saves the dynamic module to disk, so you can examine it using the MSIL Disassembler (Ildasm.exe).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/MakeArrayType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/VB/source.vb" id="Snippet1":::
@@ -3848,7 +3843,6 @@
## Examples
The following code example creates a generic type with two type parameters, the second of which has a base type constraint, and saves them in the assembly GenericEmitExample1.dll. You can use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to view the generated types. For a more detailed explanation of the steps involved in defining a dynamic generic type, see [How to: Define a Generic Type with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-type-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EmitGenericType/VB/source.vb" id="Snippet1":::
@@ -4100,7 +4094,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code example creates a generic type with two type parameters, the first of which is constrained to have a parameterless constructor and to be a reference type, and saves them in the assembly GenericEmitExample1.dll. You can use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to view the generated types. For a more detailed explanation of the steps involved in defining a dynamic generic type, see [How to: Define a Generic Type with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-type-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EmitGenericType/VB/source.vb" id="Snippet1":::
@@ -4211,7 +4204,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The following code example creates a generic type with two type parameters, the second of which has two interface constraints, and saves them in the assembly GenericEmitExample1.dll. You can use the [Ildasm.exe (IL Disassembler)](/dotnet/framework/tools/ildasm-exe-il-disassembler) to view the generated types. For a more detailed explanation of the steps involved in defining a dynamic generic type, see [How to: Define a Generic Type with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-type-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/GenericTypeParameterBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/EmitGenericType/VB/source.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/ILGenerator.xml b/xml/System.Reflection.Emit/ILGenerator.xml
index 49639a6e8a1..67b0a7d149b 100644
--- a/xml/System.Reflection.Emit/ILGenerator.xml
+++ b/xml/System.Reflection.Emit/ILGenerator.xml
@@ -177,7 +177,6 @@
## Examples
The code sample below demonstrates the contextual usage of the `BeginCatchBlock` method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginCatchBlock/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/VB/source.vb" id="Snippet1":::
@@ -302,7 +301,6 @@
## Examples
The code sample below demonstrates the contextual usage of the `BeginExceptionBlock` method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginCatchBlock/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/VB/source.vb" id="Snippet1":::
@@ -363,7 +361,6 @@
## Examples
The following code sample illustrates the use of `BeginFaultBlock`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginFaultBlock/ilgenerator_beginfaultblock.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/VB/ilgenerator_beginfaultblock.vb" id="Snippet1":::
@@ -424,7 +421,6 @@
## Examples
The following code sample illustrates the use of `BeginFinallyBlock`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginFinallyBlock/ilgenerator_beginfinallyblock_2.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/VB/ilgenerator_beginfinallyblock_2.vb" id="Snippet2":::
@@ -488,7 +484,6 @@
## Examples
The following code sample illustrates the use of `BeginScope` and `EndScope`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginScope/ilgenerator_begin_endscope.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ILGenerator_Begin_EndScope/VB/ilgenerator_begin_endscope.vb" id="Snippet2":::
@@ -596,7 +591,6 @@
## Examples
The following code example demonstrates the use of the `DeclareLocal` method. This code is part of a larger code example for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DeclareLocal/localbuilder_sample_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/VB/localbuilder_sample_4.vb" id="Snippet2":::
@@ -731,7 +725,6 @@
## Examples
The code sample below demonstrates the contextual usage of the `DefineLabel` method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DefineLabel/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/VB/source.vb" id="Snippet1":::
@@ -807,7 +800,6 @@
## Examples
The code sample below demonstrates the use of `Emit` to generate MSIL output via an instance of .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/Emit/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/VB/source.vb" id="Snippet1":::
@@ -1237,7 +1229,6 @@
## Examples
The code sample below illustrates the creation of a dynamic method with a jump table. The jump table is built using an array of .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/Emit/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/VB/source.vb" id="Snippet1":::
@@ -1305,7 +1296,6 @@
## Examples
The code sample below illustrates the creation of a dynamic method with a jump table. The jump table is built using an array of .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/Emit/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/VB/source.vb" id="Snippet1":::
@@ -1887,7 +1877,6 @@ The method does not throw
@@ -1983,7 +1972,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The following code sample demonstrates the contextual usage of the method to call an unmanaged type method external to the dynamic class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/EmitCalli/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/VB/source.vb" id="Snippet1":::
@@ -2152,7 +2140,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The code sample below demonstrates the contextual usage of the method to write a string to the console in a dynamic method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/EmitWriteLine/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/VB/source.vb" id="Snippet1":::
@@ -2225,7 +2212,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The following code sample demonstrates the use of the method to write a string to the console in a dynamic method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/EmitWriteLine/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/VB/source.vb" id="Snippet1":::
@@ -2295,7 +2281,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The code sample below demonstrates the contextual usage of the `EmitWriteLine` method to write a string to the console in a dynamic method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/EmitWriteLine/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/VB/source.vb" id="Snippet1":::
@@ -2351,7 +2336,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The code sample below demonstrates the contextual usage of the `EndExceptionBlock` method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginCatchBlock/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/VB/source.vb" id="Snippet1":::
@@ -2416,7 +2400,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The following code sample illustrates the use of `BeginScope` and `EndScope`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginScope/ilgenerator_begin_endscope.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ILGenerator_Begin_EndScope/VB/ilgenerator_begin_endscope.vb" id="Snippet2":::
@@ -2534,7 +2517,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The code sample below demonstrates the contextual usage of `MarkLabel` to implement MSIL branching in a dynamic method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/Emit/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/VB/source.vb" id="Snippet1":::
@@ -2910,7 +2892,6 @@ The following code example emits two methods, a `varargs` method and a method th
## Examples
The following code sample demonstrates the contextual usage of `ThrowException` to throw an exception inside the MSIL of a dynamic method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/BeginCatchBlock/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/VB/source.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/LocalBuilder.xml b/xml/System.Reflection.Emit/LocalBuilder.xml
index f4b41cbbd4b..bbfe6ac0799 100644
--- a/xml/System.Reflection.Emit/LocalBuilder.xml
+++ b/xml/System.Reflection.Emit/LocalBuilder.xml
@@ -91,7 +91,6 @@
## Examples
The following example creates a `static` method (`Shared` in Visual Basic) named `Function1` that returns a string and has a parameter of type . In the body of the method, the code example creates objects representing two local variables, and sets symbol information for the local variables. The method does not do anything significant, but the method body demonstrates storing a parameter to a local variable, storing a literal string to a local variable, and loading a local variable.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DeclareLocal/localbuilder_sample_4.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/VB/localbuilder_sample_4.vb" id="Snippet1":::
@@ -262,7 +261,6 @@
## Examples
The following code sample illustrates the use of `LocalType`. This code is part of a larger example for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DeclareLocal/localbuilder_sample_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/VB/localbuilder_sample_4.vb" id="Snippet2":::
@@ -322,7 +320,6 @@
## Examples
The following code sample illustrates the use of the method. This code is part of a larger example for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DeclareLocal/localbuilder_sample_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/VB/localbuilder_sample_4.vb" id="Snippet2":::
@@ -387,7 +384,6 @@
## Examples
The following code sample illustrates the use of the method. This code is part of a larger example for the class.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/DeclareLocal/localbuilder_sample_4.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/VB/localbuilder_sample_4.vb" id="Snippet2":::
diff --git a/xml/System.Reflection.Emit/MethodBuilder.xml b/xml/System.Reflection.Emit/MethodBuilder.xml
index cbbc9579727..3fd52ef3073 100644
--- a/xml/System.Reflection.Emit/MethodBuilder.xml
+++ b/xml/System.Reflection.Emit/MethodBuilder.xml
@@ -79,7 +79,6 @@
class to create a method within a dynamic type.
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/VB/source.vb" id="Snippet1":::
]]>
@@ -163,7 +162,6 @@ The following example uses the class
## Examples
The code sample below illustrates the contextual use of `AddDeclarativeSecurity` to require the caller of a method to have unrestricted permissions.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/AddDeclarativeSecurity/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/VB/source.vb" id="Snippet1":::
@@ -363,7 +361,6 @@ The following example uses the class
## Examples
In the example provided below, a simple method that adds two integers is generated via opcode using `CreateMethodBody`.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/CreateMethodBody/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/VB/source.vb" id="Snippet1":::
@@ -432,7 +429,6 @@ The following example uses the class
## Examples
The following code illustrates the use of the `Type` property.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DeclaringType/methodbuilderclass.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MethodBuilderClass_TypeSample/VB/methodbuilderclass.vb" id="Snippet1":::
@@ -510,7 +506,6 @@ The following example uses the class
> [!NOTE]
> This code example generates a simple method body that merely returns a null reference. For a code example with a more fully developed method body that creates and uses generic types, see [How to: Define a Generic Method with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-method-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet1":::
@@ -1123,7 +1118,6 @@ The following example uses the class
## Examples
The code sample below demonstrates the contextual usage of the `GetILGenerator` method, creating and emitting a dynamic assembly that will calculate the dot product of two points in 3D space.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/GetILGenerator/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/VB/source.vb" id="Snippet1":::
@@ -1184,7 +1178,6 @@ The following example uses the class
## Examples
The code sample below demonstrates the contextual usage of the `GetILGenerator` method, creating and emitting a dynamic assembly that will calculate the dot product of two points in 3D space.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/GetILGenerator/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/VB/source.vb" id="Snippet1":::
@@ -1303,7 +1296,6 @@ The following example uses the class
## Examples
The sample code below illustrates the usage of the `GetModule` method to retrieve information about a dynamically-generated module.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ConstructorBuilder/GetModule/source3.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/VB/source3.vb" id="Snippet1":::
@@ -1356,7 +1348,6 @@ The following example uses the class
## Examples
The code sample below illustrates the use of `GetParameters` to discover information on the parameters passed to a dynamically-generated method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/GetParameters/source4.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/VB/source4.vb" id="Snippet1":::
@@ -1675,7 +1666,6 @@ The following example uses the class
## Examples
The following code example displays the status of a method. This code is part of a larger example provided for the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet7":::
@@ -1733,7 +1723,6 @@ The following example uses the class
## Examples
The following code example displays the status of a method. This code is part of a larger example provided for the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet7":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet7":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet7":::
@@ -1948,7 +1937,6 @@ The following example uses the class
> [!NOTE]
> For another code example that uses , see . is also used extensively when emitting code that uses generic types. See [How to: Define a Generic Method with Reflection Emit](/dotnet/framework/reflection-and-codedom/how-to-define-a-generic-method-with-reflection-emit).
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/MakeGenericMethod/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/vb/source.vb" id="Snippet1":::
@@ -2588,7 +2576,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The code sample below illustrates the contextual use of the `SetImplementationFlags` method to describe the implementation of MSIL in a method body.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/SetImplementationFlags/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/VB/source.vb" id="Snippet1":::
@@ -2675,7 +2662,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The code sample below illustrates the contextual usage of the `SetMarshal` method to marshal the results of a method call as a different type.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/SetMarshal/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/VB/source.vb" id="Snippet1":::
@@ -2814,10 +2800,8 @@ For information on how to format `binaryAttribute`, see the metadata specificati
This code is part of a larger example provided for the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet3":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet5":::
@@ -2890,10 +2874,8 @@ For information on how to format `binaryAttribute`, see the metadata specificati
This code is part of a larger example provided for the method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet3":::
-:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp" id="Snippet5":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/DefineGenericParameters/source.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/GenericMethodBuilder/VB/source.vb" id="Snippet5":::
@@ -3141,7 +3123,6 @@ For information on how to format `binaryAttribute`, see the metadata specificati
## Examples
The code sample below illustrates the contextual usage of the `SetSymCustomAttribute` method to set the byte values for the name and key of a custom attribute attached to a method.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/MethodBuilder/SetSymCustomAttribute/source2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/VB/source2.vb" id="Snippet1":::
diff --git a/xml/System.Reflection.Emit/MethodRental.xml b/xml/System.Reflection.Emit/MethodRental.xml
index c51830a3637..2ebd010c3b4 100644
--- a/xml/System.Reflection.Emit/MethodRental.xml
+++ b/xml/System.Reflection.Emit/MethodRental.xml
@@ -123,22 +123,21 @@
Flags that control the swapping. See the definitions of the constants.
Swaps the body of a method.
-
@@ -183,11 +182,11 @@
Caller-allocated array which receives the IDs corresponding to the names.
Maps a set of names to a corresponding set of dispatch identifiers.
- The method is called late-bound using the COM IDispatch interface.
@@ -224,11 +223,11 @@
Receives a pointer to the requested type information object.
Retrieves the type information for an object, which can then be used to get the type information for an interface.
- The method is called late-bound using the COM IDispatch interface.
@@ -261,11 +260,11 @@
Points to a location that receives the number of type information interfaces provided by the object.
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
- The method is called late-bound using the COM IDispatch interface.
@@ -312,11 +311,11 @@
The index of the first argument that has an error.
Provides access to properties and methods exposed by an object.
- The method is called late-bound using the COM IDispatch interface.
diff --git a/xml/System.Reflection.Emit/ModuleBuilder.xml b/xml/System.Reflection.Emit/ModuleBuilder.xml
index cbaad27085b..69959bc270c 100644
--- a/xml/System.Reflection.Emit/ModuleBuilder.xml
+++ b/xml/System.Reflection.Emit/ModuleBuilder.xml
@@ -85,7 +85,6 @@
## Examples
The following code sample demonstrates the use of `ModuleBuilder` to create a dynamic module. Note that the ModuleBuilder is created by calling in , rather than through a constructor.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/Overview/modulebuilder.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_Class/VB/modulebuilder.vb" id="Snippet1":::
@@ -217,7 +216,6 @@
## Examples
The following sample illustrates the use of `CreateGlobalFunctions` to create a static global method from a implemented with .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/CreateGlobalFunctions/modulebuilder_createglobalfunctions.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/VB/modulebuilder_createglobalfunctions.vb" id="Snippet2":::
@@ -346,7 +344,6 @@
## Examples
The following code sample illustrates the use of `DefineDocument` to attach an external symbol document (in this case, a raw IL file) to a dynamic module.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Diagnostics.SymbolStore/ISymbolDocumentWriter/Overview/modulebuilder_definedocument.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineDocument/VB/modulebuilder_definedocument.vb" id="Snippet1":::
@@ -462,7 +459,6 @@
> [!NOTE]
> Prior to the .NET Framework version 2.0, this code example does not produce a correct enumeration.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/EnumBuilder/Overview/modulebuilder_defineenum.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineEnum/VB/modulebuilder_defineenum.vb" id="Snippet1":::
@@ -602,7 +598,6 @@
## Examples
The following example illustrates the use of `DefineGlobalMethod` to create a type-independent method tied to the current . After building the global method, must be called in order to complete it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/CreateGlobalFunctions/modulebuilder_createglobalfunctions.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/VB/modulebuilder_createglobalfunctions.vb" id="Snippet1":::
@@ -702,7 +697,6 @@
## Examples
The following code sample illustrates the use of `DefineGlobalMethod` to create a type-independent method tied to the current . After building the global method, must be called in order to complete it.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/CreateGlobalFunctions/modulebuilder_createglobalfunctions.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/VB/modulebuilder_createglobalfunctions.vb" id="Snippet1":::
@@ -998,7 +992,6 @@
## Examples
The following example uses the method to define an initialized data field in the `.sdata` section of the portable executable (PE) file.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineInitializedData/modulebuilder_defineinitializeddata.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/VB/modulebuilder_defineinitializeddata.vb" id="Snippet1":::
@@ -1237,7 +1230,6 @@
> [!IMPORTANT]
> To get a non-zero return value, you must add to the method implementation flags after you create the , by using the and methods.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefinePInvokeMethod/modulebuilder_definepinvokemethod1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/VB/modulebuilder_definepinvokemethod1.vb" id="Snippet1":::
@@ -1357,7 +1349,6 @@
This example uses a different overload of the method, but the technique is the same.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefinePInvokeMethod/modulebuilder_definepinvokemethod1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/VB/modulebuilder_definepinvokemethod1.vb" id="Snippet1":::
@@ -1493,7 +1484,6 @@
## Examples
The following example illustrates the use of `DefineResource` to add an external resource to the current .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineResource/modulebuilder_defineresource1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineResource1/VB/modulebuilder_defineresource1.vb" id="Snippet1":::
@@ -1560,7 +1550,6 @@
## Examples
The following example illustrates the use of DefineResource to add an external resource to the current .
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineResource/modulebuilder_defineresource2.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_DefineResource2/VB/modulebuilder_defineresource2.vb" id="Snippet1":::
@@ -1649,7 +1638,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -1728,7 +1716,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -1821,7 +1808,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -1916,7 +1902,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -2011,7 +1996,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -2117,7 +2101,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -2214,7 +2197,6 @@
## Examples
The following example creates a in the current dynamic module using `CreateType`, builds and completes the type, and saves the assembly.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/DefineType/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/VB/source.vb" id="Snippet1":::
@@ -2701,7 +2683,6 @@
## Examples
The following example demonstrates how to use to obtain the corresponding to a method that returns an array value.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/GetArrayMethod/modulebuilder_getarraymethod.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/VB/modulebuilder_getarraymethod.vb" id="Snippet1":::
@@ -2821,7 +2802,6 @@
## Examples
The following example demonstrates how to use to obtain the corresponding to a method that returns an array value.
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ModuleBuilder/GetArrayMethod/modulebuilder_getarraymethod.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/VB/modulebuilder_getarraymethod.vb" id="Snippet2":::
diff --git a/xml/System.Reflection.Emit/OpCodes.xml b/xml/System.Reflection.Emit/OpCodes.xml
index f56be8851d1..539e53de671 100644
--- a/xml/System.Reflection.Emit/OpCodes.xml
+++ b/xml/System.Reflection.Emit/OpCodes.xml
@@ -52,18 +52,17 @@
Provides field representations of the Microsoft Intermediate Language (MSIL) instructions for emission by the class members (such as ).
- to emit `OpCodes` into a .
-
- :::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp" id="Snippet1":::
+
+## Examples
+ The following example demonstrates the construction of a dynamic method using to emit `OpCodes` into a .
+
:::code language="csharp" source="~/snippets/csharp/System.Reflection.Emit/ILGenerator/EmitWriteLine/source.cs" id="Snippet1":::
- :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/VB/source.vb" id="Snippet1":::
-
+ :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/VB/source.vb" id="Snippet1":::
+
]]>
@@ -107,54 +106,54 @@
Adds two values and pushes the result onto the evaluation stack.
- ).
-
- Integer addition wraps, rather than saturates. For example, assuming 8-bit integers where `value1` is set to 255 and `value2` is set to 1, the wrapped result is 0 rather than 256.
-
- Floating-point overflow returns `+inf` (`PositiveInfinity`) or `-inf` (`NegativeInfinity`).
-
- The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) and generates an error.
-
-|operand|value1 type|value2 type|result type|
-|-------------|-----------------|-----------------|-----------------|
-|add|`int32`|`int32`|`int32`|
-|add|`int32`|`native int`|`native int`|
-|add|`int32`|`&`|`&`|
-|add|`int32`|`*`|`*`|
-|add|`int64`|`int64`|`int64`|
-|add|`native int`|`int32`|`native int`|
-|add|`native int`|`native int`|`native int`|
-|add|`native int`|`&`|`&`|
-|add|`native int`|`*`|`*`|
-|add|`F`|`F`|`F`|
-|add|`&`|`int32`|`&`|
-|add|`&`|`native int`|`&`|
-|add|`*`|`int32`|`*`|
-|add|`*`|`native int`|`*`|
-
- The following method overload can use the `add` opcode:
-
--
-
+ ).
+
+ Integer addition wraps, rather than saturates. For example, assuming 8-bit integers where `value1` is set to 255 and `value2` is set to 1, the wrapped result is 0 rather than 256.
+
+ Floating-point overflow returns `+inf` (`PositiveInfinity`) or `-inf` (`NegativeInfinity`).
+
+ The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) and generates an error.
+
+|operand|value1 type|value2 type|result type|
+|-------------|-----------------|-----------------|-----------------|
+|add|`int32`|`int32`|`int32`|
+|add|`int32`|`native int`|`native int`|
+|add|`int32`|`&`|`&`|
+|add|`int32`|`*`|`*`|
+|add|`int64`|`int64`|`int64`|
+|add|`native int`|`int32`|`native int`|
+|add|`native int`|`native int`|`native int`|
+|add|`native int`|`&`|`&`|
+|add|`native int`|`*`|`*`|
+|add|`F`|`F`|`F`|
+|add|`&`|`int32`|`&`|
+|add|`&`|`native int`|`&`|
+|add|`*`|`int32`|`*`|
+|add|`*`|`native int`|`*`|
+
+ The following method overload can use the `add` opcode:
+
+-
+
]]>
@@ -198,52 +197,52 @@
Adds two integers, performs an overflow check, and pushes the result onto the evaluation stack.
- is thrown if the result is not represented in the result type.
-
- You can perform this operation on signed integers. For floating-point values, use .
-
- The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) instruction and generates an error.
-
-|operand|value1 type|value2 type|result type|
-|-------------|-----------------|-----------------|-----------------|
-|add|`int32`|`int32`|`int32`|
-|add|`int32`|`native int`|`native int`|
-|add|`int32`|`&`|`&`|
-|add|`int32`|`*`|`*`|
-|add|`int64`|`int64`|`int64`|
-|add|`native int`|`int32`|`native int`|
-|add|`native int`|`native int`|`native int`|
-|add|`native int`|`&`|`&`|
-|add|`native int`|`*`|`*`|
-|add|`F`|`F`|`F`|
-|add|`&`|`int32`|`&`|
-|add|`&`|`native int`|`&`|
-|add|`*`|`int32`|`*`|
-|add|`*`|`native int`|`*`|
-
- The following method overload can use the `add.ovf` opcode:
-
--
-
+ is thrown if the result is not represented in the result type.
+
+ You can perform this operation on signed integers. For floating-point values, use .
+
+ The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) instruction and generates an error.
+
+|operand|value1 type|value2 type|result type|
+|-------------|-----------------|-----------------|-----------------|
+|add|`int32`|`int32`|`int32`|
+|add|`int32`|`native int`|`native int`|
+|add|`int32`|`&`|`&`|
+|add|`int32`|`*`|`*`|
+|add|`int64`|`int64`|`int64`|
+|add|`native int`|`int32`|`native int`|
+|add|`native int`|`native int`|`native int`|
+|add|`native int`|`&`|`&`|
+|add|`native int`|`*`|`*`|
+|add|`F`|`F`|`F`|
+|add|`&`|`int32`|`&`|
+|add|`&`|`native int`|`&`|
+|add|`*`|`int32`|`*`|
+|add|`*`|`native int`|`*`|
+
+ The following method overload can use the `add.ovf` opcode:
+
+-
+
]]>
@@ -287,52 +286,52 @@
Adds two unsigned integer values, performs an overflow check, and pushes the result onto the evaluation stack.
- is thrown if the result is not represented in the result type.
-
- You can perform this operation on signed integers. For floating-point values, use .
-
- The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) instruction and generates an error.
-
-|operand|value1 type|value2 type|result type|
-|-------------|-----------------|-----------------|-----------------|
-|add|`int32`|`int32`|`int32`|
-|add|`int32`|`native int`|`native int`|
-|add|`int32`|`&`|`&`|
-|add|`int32`|`*`|`*`|
-|add|`int64`|`int64`|`int64`|
-|add|`native int`|`int32`|`native int`|
-|add|`native int`|`native int`|`native int`|
-|add|`native int`|`&`|`&`|
-|add|`native int`|`*`|`*`|
-|add|`F`|`F`|`F`|
-|add|`&`|`int32`|`&`|
-|add|`&`|`native int`|`&`|
-|add|`*`|`int32`|`*`|
-|add|`*`|`native int`|`*`|
-
- The following method overload can use the `add.ovf.un` opcode:
-
--
-
+ is thrown if the result is not represented in the result type.
+
+ You can perform this operation on signed integers. For floating-point values, use .
+
+ The acceptable operand types and their corresponding result data type are listed in the table below. If there is no entry for a particular type combination (for example, `int32` and `float`; `int32` and `int64`), it is an invalid Microsoft Intermediate Language (MSIL) instruction and generates an error.
+
+|operand|value1 type|value2 type|result type|
+|-------------|-----------------|-----------------|-----------------|
+|add|`int32`|`int32`|`int32`|
+|add|`int32`|`native int`|`native int`|
+|add|`int32`|`&`|`&`|
+|add|`int32`|`*`|`*`|
+|add|`int64`|`int64`|`int64`|
+|add|`native int`|`int32`|`native int`|
+|add|`native int`|`native int`|`native int`|
+|add|`native int`|`&`|`&`|
+|add|`native int`|`*`|`*`|
+|add|`F`|`F`|`F`|
+|add|`&`|`int32`|`&`|
+|add|`&`|`native int`|`&`|
+|add|`*`|`int32`|`*`|
+|add|`*`|`native int`|`*`|
+
+ The following method overload can use the `add.ovf.un` opcode:
+
+-
+
]]>
@@ -376,33 +375,33 @@
Computes the bitwise AND of two values and pushes the result onto the evaluation stack.
- method overload can use the `and` opcode:
-
--
-
+ method overload can use the `and` opcode:
+
+-
+
]]>
@@ -446,23 +445,23 @@
Returns an unmanaged pointer to the argument list of the current method.
- method overload can use the `arglist` opcode:
-
--
-
+ method overload can use the `arglist` opcode:
+
+-
+
]]>
@@ -506,35 +505,35 @@
Transfers control to a target instruction if two values are equal.
- |beq `target`|Branch to the target instruction at offset `target` if the two values are equal.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is equal to `value2`, the branch operation is performed.
-
- The `beq` instruction transfers control to the specified target instruction if `value1` is equal to `value2`. The effect is the same as performing a `ceq` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- The acceptable operand types are encapsulated below:
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes.
-
- Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction (such transfers are severely restricted and must use the instruction instead).
-
- The following method overload can use the `beq` opcode:
-
--
-
+ |beq `target`|Branch to the target instruction at offset `target` if the two values are equal.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is equal to `value2`, the branch operation is performed.
+
+ The `beq` instruction transfers control to the specified target instruction if `value1` is equal to `value2`. The effect is the same as performing a `ceq` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ The acceptable operand types are encapsulated below:
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes.
+
+ Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction (such transfers are severely restricted and must use the instruction instead).
+
+ The following method overload can use the `beq` opcode:
+
+-
+
]]>
@@ -578,35 +577,35 @@
Transfers control to a target instruction (short form) if two values are equal.
- |beq.s `target`|Branch to the target instruction at offset `target` if equal, short form|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is equal to `value2`, the branch operation is performed.
-
- The `beq.s` instruction transfers control to the specified target instruction if `value1` is equal to `value2`. The effect is the same as performing a `ceq` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- The acceptable operand types are encapsulated below:
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes.
-
- Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction (such transfers are severely restricted and must use the instruction instead).
-
- The following method overload can use the `beq.s` opcode:
-
--
-
+ |beq.s `target`|Branch to the target instruction at offset `target` if equal, short form|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is equal to `value2`, the branch operation is performed.
+
+ The `beq.s` instruction transfers control to the specified target instruction if `value1` is equal to `value2`. The effect is the same as performing a `ceq` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ The acceptable operand types are encapsulated below:
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes.
+
+ Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction (such transfers are severely restricted and must use the instruction instead).
+
+ The following method overload can use the `beq.s` opcode:
+
+-
+
]]>
@@ -650,31 +649,31 @@
Transfers control to a target instruction if the first value is greater than or equal to the second value.
- `|bge `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
-
- The `bge` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`. The effect is identical to performing a `clt` instruction (`clt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bge` opcode:
-
--
-
+ `|bge `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
+
+ The `bge` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`. The effect is identical to performing a `clt` instruction (`clt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bge` opcode:
+
+-
+
]]>
@@ -718,31 +717,31 @@
Transfers control to a target instruction (short form) if the first value is greater than or equal to the second value.
- `|bge.s `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
-
- The `bge.s` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`. The effect is identical to performing a `clt` instruction (`clt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bge.s` opcode:
-
--
-
+ `|bge.s `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
+
+ The `bge.s` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`. The effect is identical to performing a `clt` instruction (`clt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bge.s` opcode:
+
+-
+
]]>
@@ -786,31 +785,31 @@
Transfers control to a target instruction if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
- `|bge.un `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value (unsigned values).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
-
- The `bge.un` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction (`clt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bge.un` opcode:
-
--
-
+ `|bge.un `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value (unsigned values).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
+
+ The `bge.un` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction (`clt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bge.un` opcode:
+
+-
+
]]>
@@ -854,31 +853,31 @@
Transfers control to a target instruction (short form) if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
- |bge.un.s `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value (unsigned values), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
-
- The `bge.un.s` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction (`clt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bge.un.s` opcode:
-
--
-
+ |bge.un.s `target`|Branch to the target instruction at the specified offset if the first value is greater than or equal to the second value (unsigned values), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than or equal to `value2`, the branch operation is performed.
+
+ The `bge.un.s` instruction transfers control to the specified target instruction if `value1` is greater than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction (`clt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bge.un.s` opcode:
+
+-
+
]]>
@@ -922,31 +921,31 @@
Transfers control to a target instruction if the first value is greater than the second value.
- |bgt `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
-
- The `bgt` instruction transfers control to the specified target instruction if `value1` is greater than `value2`. The effect is identical to performing a `cgt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bgt` opcode:
-
--
-
+ |bgt `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
+
+ The `bgt` instruction transfers control to the specified target instruction if `value1` is greater than `value2`. The effect is identical to performing a `cgt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bgt` opcode:
+
+-
+
]]>
@@ -990,31 +989,31 @@
Transfers control to a target instruction (short form) if the first value is greater than the second value.
- |bgt.s `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
-
- The `bgt.s` instruction transfers control to the specified target instruction if `value1` is greater than `value2`. The effect is identical to performing a `cgt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bgt.s` opcode:
-
--
-
+ |bgt.s `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
+
+ The `bgt.s` instruction transfers control to the specified target instruction if `value1` is greater than `value2`. The effect is identical to performing a `cgt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bgt.s` opcode:
+
+-
+
]]>
@@ -1058,31 +1057,31 @@
Transfers control to a target instruction if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
- |bgt.un `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value (unsigned values).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
-
- The `bgt.un` instruction transfers control to the specified target instruction if `value1` is greater than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bgt.un` opcode:
-
--
-
+ |bgt.un `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value (unsigned values).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
+
+ The `bgt.un` instruction transfers control to the specified target instruction if `value1` is greater than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bgt.un` opcode:
+
+-
+
]]>
@@ -1126,31 +1125,31 @@
Transfers control to a target instruction (short form) if the first value is greater than the second value, when comparing unsigned integer values or unordered float values.
- |bgt.un.s `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value (unsigned values), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
-
- The `bgt.un.s` instruction transfers control to the specified target instruction if `value1` is greater than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bgt.un.s` opcode:
-
--
-
+ |bgt.un.s `target`|Branch to the target instruction at the specified offset if the first value is greater than the second value (unsigned values), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is greater than `value2`, the branch operation is performed.
+
+ The `bgt.un.s` instruction transfers control to the specified target instruction if `value1` is greater than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bgt.un.s` opcode:
+
+-
+
]]>
@@ -1194,31 +1193,31 @@
Transfers control to a target instruction if the first value is less than or equal to the second value.
- `|ble `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
-
- The `ble` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `cgt` instruction (`cgt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `ble` opcode:
-
--
-
+ `|ble `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
+
+ The `ble` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `cgt` instruction (`cgt.un` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `ble` opcode:
+
+-
+
]]>
@@ -1262,31 +1261,31 @@
Transfers control to a target instruction (short form) if the first value is less than or equal to the second value.
- `|ble.s `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
-
- The `ble.s` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `cgt` instruction (`cgt.un` for floats) instruction followed by a`brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `ble.s` opcode:
-
--
-
+ `|ble.s `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
+
+ The `ble.s` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `cgt` instruction (`cgt.un` for floats) instruction followed by a`brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `ble.s` opcode:
+
+-
+
]]>
@@ -1330,31 +1329,31 @@
Transfers control to a target instruction if the first value is less than or equal to the second value, when comparing unsigned integer values or unordered float values.
- `|ble.un `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value (unsigned values).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
-
- The `ble.un` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction (`cgt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `ble.un` opcode:
-
--
-
+ `|ble.un `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value (unsigned values).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
+
+ The `ble.un` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction (`cgt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `ble.un` opcode:
+
+-
+
]]>
@@ -1398,31 +1397,31 @@
Transfers control to a target instruction (short form) if the first value is less than or equal to the second value, when comparing unsigned integer values or unordered float values.
- `|ble.un.s `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value (unsigned values), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
-
- The `ble.un.s` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction (`cgt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `ble.un.s` opcode:
-
--
-
+ `|ble.un.s `target`|Branch to the target instruction at the specified offset if the first value is less than or equal to the second value (unsigned values), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than or equal to `value2`, the branch operation is performed.
+
+ The `ble.un.s` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `cgt.un` instruction (`cgt` for floats) followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `ble.un.s` opcode:
+
+-
+
]]>
@@ -1466,31 +1465,31 @@
Transfers control to a target instruction if the first value is less than the second value.
- |blt `target`|Branch to the target instruction at the specified offset if the first value is less than the second value.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
-
- The `blt` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `clt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `blt` opcode:
-
--
-
+ |blt `target`|Branch to the target instruction at the specified offset if the first value is less than the second value.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
+
+ The `blt` instruction transfers control to the specified target instruction if `value1` is less than or equal to `value2`. The effect is identical to performing a `clt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `blt` opcode:
+
+-
+
]]>
@@ -1534,31 +1533,31 @@
Transfers control to a target instruction (short form) if the first value is less than the second value.
- |blt.s `target`|Branch to the target instruction at the specified offset if the first value is less than the second value, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
-
- The `blt.s` instruction transfers control to the specified target instruction if `value1` is less than `value2`. The effect is identical to performing a `clt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `blt.s` opcode:
-
--
-
+ |blt.s `target`|Branch to the target instruction at the specified offset if the first value is less than the second value, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
+
+ The `blt.s` instruction transfers control to the specified target instruction if `value1` is less than `value2`. The effect is identical to performing a `clt` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `blt.s` opcode:
+
+-
+
]]>
@@ -1602,41 +1601,41 @@
Transfers control to a target instruction if the first value is less than the second value, when comparing unsigned integer values or unordered float values.
- |blt.un `target`|Branch to the target instruction at the specified offset if the first value is less than the second value (unsigned values).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
-
- The `blt.un` instruction transfers control to the specified target instruction if `value1` is less than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `blt.un` opcode:
-
--
-
- ]]>
-
-
-
-
-
-
-
-
-
+ |blt.un `target`|Branch to the target instruction at the specified offset if the first value is less than the second value (unsigned values).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
+
+ The `blt.un` instruction transfers control to the specified target instruction if `value1` is less than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `blt.un` opcode:
+
+-
+
+ ]]>
+
+
+
+
+
+
+
+
+ Field
@@ -1670,31 +1669,31 @@
Transfers control to a target instruction (short form) if the first value is less than the second value, when comparing unsigned integer values or unordered float values.
- |blt.un.s `target`|Branch to the target instruction at the specified offset if the first value is less than the second value (unsigned values), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
-
- The `blt.un` instruction transfers control to the specified target instruction if `value1` is less than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `blt.un.s` opcode:
-
--
-
+ |blt.un.s `target`|Branch to the target instruction at the specified offset if the first value is less than the second value (unsigned values), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is less than `value2`, the branch operation is performed.
+
+ The `blt.un` instruction transfers control to the specified target instruction if `value1` is less than `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `clt.un` instruction followed by a `brtrue` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `blt.un.s` opcode:
+
+-
+
]]>
@@ -1738,31 +1737,31 @@
Transfers control to a target instruction when two unsigned integer values or unordered float values are not equal.
- |bne.un `target`|Branch to the target instruction at the specified offset if two unsigned integer values are not equal (unsigned values).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is not equal to `value2`, the branch operation is performed.
-
- The `bne.un` instruction transfers control to the specified target instruction if `value1` is not equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `ceq` instruction followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bne.un` opcode:
-
--
-
+ |bne.un `target`|Branch to the target instruction at the specified offset if two unsigned integer values are not equal (unsigned values).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is not equal to `value2`, the branch operation is performed.
+
+ The `bne.un` instruction transfers control to the specified target instruction if `value1` is not equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `ceq` instruction followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bne.un` opcode:
+
+-
+
]]>
@@ -1806,31 +1805,31 @@
Transfers control to a target instruction (short form) when two unsigned integer values or unordered float values are not equal.
- |bne.un.s `target`|Branch to the target instruction at the specified offset if two unsigned integer values are not equal (unsigned values), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value1` is pushed onto the stack.
-
-2. `value2` is pushed onto the stack.
-
-3. `value2` and `value1` are popped from the stack; if `value1` is not equal to `value2`, the branch operation is performed.
-
- The `bne.un` instruction transfers control to the specified target instruction if `value1` is not equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `ceq` instruction followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `bne.un.s` opcode:
-
--
-
+ |bne.un.s `target`|Branch to the target instruction at the specified offset if two unsigned integer values are not equal (unsigned values), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value1` is pushed onto the stack.
+
+2. `value2` is pushed onto the stack.
+
+3. `value2` and `value1` are popped from the stack; if `value1` is not equal to `value2`, the branch operation is performed.
+
+ The `bne.un` instruction transfers control to the specified target instruction if `value1` is not equal to `value2`, when compared using unsigned integer or unordered float values. The effect is identical to performing a `ceq` instruction followed by a `brfalse` branch to the specific target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `bne.un.s` opcode:
+
+-
+
]]>
@@ -1874,39 +1873,39 @@
Converts a value type to an object reference (type ).
- |box `valTypeToken`|Convert a value type (of the type specified in `valTypeToken`) to a true object reference.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. A value type is pushed onto the stack.
-
-2. The value type is popped from the stack; the `box` operation is performed.
-
-3. An object reference to the resulting "boxed" value type is pushed onto the stack.
-
- A value type has two separate representations within the Common Language Infrastructure (CLI):
-
-- A 'raw' form used when a value type is embedded within another object or on the stack.
-
-- A 'boxed' form, where the data in the value type is wrapped (boxed) into an object so it can exist as an independent entity.
-
- The `box` instruction converts the 'raw' (unboxed) value type into an object reference (type `O`). This is accomplished by creating a new object and copying the data from the value type into the newly allocated object. `valTypeToken` is a metadata token indicating the type of the value type on the stack.
-
- is thrown if there is insufficient memory to satisfy the request.
-
- is thrown if the class cannot be found. This is typically detected when Microsoft Intermediate Language (MSIL) is converted to native code, rather than at runtime.
-
- The following method overload can use the `box` opcode:
-
--
-
+ |box `valTypeToken`|Convert a value type (of the type specified in `valTypeToken`) to a true object reference.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. A value type is pushed onto the stack.
+
+2. The value type is popped from the stack; the `box` operation is performed.
+
+3. An object reference to the resulting "boxed" value type is pushed onto the stack.
+
+ A value type has two separate representations within the Common Language Infrastructure (CLI):
+
+- A 'raw' form used when a value type is embedded within another object or on the stack.
+
+- A 'boxed' form, where the data in the value type is wrapped (boxed) into an object so it can exist as an independent entity.
+
+ The `box` instruction converts the 'raw' (unboxed) value type into an object reference (type `O`). This is accomplished by creating a new object and copying the data from the value type into the newly allocated object. `valTypeToken` is a metadata token indicating the type of the value type on the stack.
+
+ is thrown if there is insufficient memory to satisfy the request.
+
+ is thrown if the class cannot be found. This is typically detected when Microsoft Intermediate Language (MSIL) is converted to native code, rather than at runtime.
+
+ The following method overload can use the `box` opcode:
+
+-
+
]]>
@@ -1950,25 +1949,25 @@
Unconditionally transfers control to a target instruction.
- |br `target`|Branches to a target instruction at the specified offset.|
-
- No evaluation stack behaviors are performed by this operation.
-
- The `br` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `br` opcode:
-
--
-
+ |br `target`|Branches to a target instruction at the specified offset.|
+
+ No evaluation stack behaviors are performed by this operation.
+
+ The `br` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `br` opcode:
+
+-
+
]]>
@@ -2012,25 +2011,25 @@
Unconditionally transfers control to a target instruction (short form).
- |br.s `target`|Branches to a target instruction at the specified offset, short form.|
-
- No evaluation stack behaviors are performed by this operation.
-
- The `br.s` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `br.s` opcode:
-
--
-
+ |br.s `target`|Branches to a target instruction at the specified offset, short form.|
+
+ No evaluation stack behaviors are performed by this operation.
+
+ The `br.s` instruction unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `br.s` opcode:
+
+-
+
]]>
@@ -2074,27 +2073,27 @@
Signals the Common Language Infrastructure (CLI) to inform the debugger that a break point has been tripped.
- method overload can use the `break` opcode:
-
--
-
+ method overload can use the `break` opcode:
+
+-
+
]]>
@@ -2138,31 +2137,31 @@
Transfers control to a target instruction if is , a null reference ( in Visual Basic), or zero.
- |brfalse `target`
brnull `target`
brzero `target`|Branches to a target instruction at the specified offset if `false`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value` is pushed onto the stack by a previous operation.
-
-2. `value` is popped from the stack; if `value` is `false`, branch to `target`.
-
- The `brfalse` instruction (and its aliases `brnull` and `brzero`) transfers control to the specified target instruction if `value` (of type `int32`, `int64`, object reference `O`, managed pointer `&`, transient pointer `*`, `native int`) is zero (`false`). If `value` is non-zero (`true`) execution continues at the next instruction.
-
- The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `brfalse` opcode:
-
--
-
+ |brfalse `target`
brnull `target`
brzero `target`|Branches to a target instruction at the specified offset if `false`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value` is pushed onto the stack by a previous operation.
+
+2. `value` is popped from the stack; if `value` is `false`, branch to `target`.
+
+ The `brfalse` instruction (and its aliases `brnull` and `brzero`) transfers control to the specified target instruction if `value` (of type `int32`, `int64`, object reference `O`, managed pointer `&`, transient pointer `*`, `native int`) is zero (`false`). If `value` is non-zero (`true`) execution continues at the next instruction.
+
+ The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `brfalse` opcode:
+
+-
+
]]>
@@ -2206,31 +2205,31 @@
Transfers control to a target instruction if is , a null reference, or zero.
- |brfalse.s `target`
brnull.s `target`
brzero.s `target`|Branches to a target instruction at the specified offset if `false`, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value` is pushed onto the stack by a previous operation.
-
-2. `value` is popped from the stack; if `value` is `false`, branch to `target`.
-
- The `brfalse.s` instruction (and its aliases `brnull` and `brzero`) transfers control to the specified target instruction if `value` (of type `int32`, `int64`, object reference `O`, managed pointer `&`, transient pointer `*`, `native int`) is zero (`false`). If `value` is non-zero (`true`) execution continues at the next instruction.
-
- The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `brfalse.s` opcode:
-
--
-
+ |brfalse.s `target`
brnull.s `target`
brzero.s `target`|Branches to a target instruction at the specified offset if `false`, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value` is pushed onto the stack by a previous operation.
+
+2. `value` is popped from the stack; if `value` is `false`, branch to `target`.
+
+ The `brfalse.s` instruction (and its aliases `brnull` and `brzero`) transfers control to the specified target instruction if `value` (of type `int32`, `int64`, object reference `O`, managed pointer `&`, transient pointer `*`, `native int`) is zero (`false`). If `value` is non-zero (`true`) execution continues at the next instruction.
+
+ The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `brfalse.s` opcode:
+
+-
+
]]>
@@ -2274,33 +2273,33 @@
Transfers control to a target instruction if is , not null, or non-zero.
- |brtrue `target`
brinst `target`|Branch to a target instruction at the specified offset if non-zero (`true`).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value` is pushed onto the stack by a previous operation.
-
-2. `value` is popped from the stack; if `value` is `true`, branch to `target`.
-
- The `brtrue` instruction transfers control to the specified target instruction if `value` (type `native int`) is nonzero (`true`). If `value` is zero (`false`) execution continues at the next instruction.
-
- If `value` is an object reference (type `O`) then `brinst` (an alias for `brtrue`) transfers control if it represents an instance of an object (for example, if it is not the null object reference; see ).
-
- The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `brtrue` opcode:
-
--
-
+ |brtrue `target`
brinst `target`|Branch to a target instruction at the specified offset if non-zero (`true`).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value` is pushed onto the stack by a previous operation.
+
+2. `value` is popped from the stack; if `value` is `true`, branch to `target`.
+
+ The `brtrue` instruction transfers control to the specified target instruction if `value` (type `native int`) is nonzero (`true`). If `value` is zero (`false`) execution continues at the next instruction.
+
+ If `value` is an object reference (type `O`) then `brinst` (an alias for `brtrue`) transfers control if it represents an instance of an object (for example, if it is not the null object reference; see ).
+
+ The target instruction is represented as a 4-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `brtrue` opcode:
+
+-
+
]]>
@@ -2344,33 +2343,33 @@
Transfers control to a target instruction (short form) if is , not null, or non-zero.
- |brtrue.s `target`
brinst.s `target`|Branch to a target instruction at the specified offset if non-zero (`true`), short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value` is pushed onto the stack by a previous operation.
-
-2. `value` is popped from the stack; if `value` is `true`, branch to `target`.
-
- The `brtrue.s` instruction transfers control to the specified target instruction if `value` (type `native int`) is nonzero (`true`). If `value` is zero (`false`) execution continues at the next instruction.
-
- If `value` is an object reference (type `O`) then `brinst` (an alias for `brtrue`) transfers control if it represents an instance of an object (for example, if it is not the null object reference; see ).
-
- The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
-
- If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
-
- The following method overload can use the `brtrue.s` opcode:
-
--
-
+ |brtrue.s `target`
brinst.s `target`|Branch to a target instruction at the specified offset if non-zero (`true`), short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value` is pushed onto the stack by a previous operation.
+
+2. `value` is popped from the stack; if `value` is `true`, branch to `target`.
+
+ The `brtrue.s` instruction transfers control to the specified target instruction if `value` (type `native int`) is nonzero (`true`). If `value` is zero (`false`) execution continues at the next instruction.
+
+ If `value` is an object reference (type `O`) then `brinst` (an alias for `brtrue`) transfers control if it represents an instance of an object (for example, if it is not the null object reference; see ).
+
+ The target instruction is represented as a 1-byte signed offset from the beginning of the instruction following the current instruction.
+
+ If the target instruction has one or more prefix codes, control can only be transferred to the first of these prefixes. Control transfers into and out of `try`, `catch`, `filter`, and `finally` blocks cannot be performed by this instruction.
+
+ The following method overload can use the `brtrue.s` opcode:
+
+-
+
]]>
@@ -2414,49 +2413,49 @@
Calls the method indicated by the passed method descriptor.
- |call `methodDesc`|Call the method described by `methodDesc`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. Method arguments `arg1` through `argN` are pushed onto the stack.
-
-2. Method arguments `arg1` through `argN` are popped from the stack; the method call is performed with these arguments and control is transferred to the method referred to by the method descriptor. When complete, a return value is generated by the callee method and sent to the caller.
-
-3. The return value is pushed onto the stack.
-
- The `call` instruction calls the method indicated by the method descriptor passed with the instruction. The method descriptor is a metadata token that indicates the method to call and the number, type, and order of the arguments that have been placed on the stack to be passed to that method as well as the calling convention to be used. The `call` instruction can be immediately preceded by a `tail` () prefix instruction to specify that the current method state should be released before transferring control. If the call transfers control to a method of higher trust than the origin method, the stack frame is not released. Instead, the execution continues silently as if the `tail` had not been supplied. The metadata token carries sufficient information to determine whether the call is to a static method, an instance method, a virtual method, or a global function. In all of these cases the destination address is determined entirely from the method descriptor (contrast this with the instruction for calling virtual methods, where the destination address also depends upon the runtime type of the instance reference pushed before the ).
-
- The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. There are three important special cases:
-
- 1. Calls to an instance (or virtual) method must push that instance reference before any of the user-visible arguments. The instance reference must not be a null reference. The signature carried in the metadata does not contain an entry in the parameter list for the `this` pointer; instead, it uses a bit to indicate whether the method requires passing the `this` pointer.
-
- 2. It is valid to call a virtual method using `call` (rather than `callvirt`); this indicates that the method is to be resolved using the class specified by method rather than as specified dynamically from the object being invoked.
-
- 3. Note that a delegate's `Invoke` method can be called with either the `call` or `callvirt` instruction.
-
- may be thrown if system security does not grant the caller access to the called method. The security check may occur when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at run time.
-
+ |call `methodDesc`|Call the method described by `methodDesc`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. Method arguments `arg1` through `argN` are pushed onto the stack.
+
+2. Method arguments `arg1` through `argN` are popped from the stack; the method call is performed with these arguments and control is transferred to the method referred to by the method descriptor. When complete, a return value is generated by the callee method and sent to the caller.
+
+3. The return value is pushed onto the stack.
+
+ The `call` instruction calls the method indicated by the method descriptor passed with the instruction. The method descriptor is a metadata token that indicates the method to call and the number, type, and order of the arguments that have been placed on the stack to be passed to that method as well as the calling convention to be used. The `call` instruction can be immediately preceded by a `tail` () prefix instruction to specify that the current method state should be released before transferring control. If the call transfers control to a method of higher trust than the origin method, the stack frame is not released. Instead, the execution continues silently as if the `tail` had not been supplied. The metadata token carries sufficient information to determine whether the call is to a static method, an instance method, a virtual method, or a global function. In all of these cases the destination address is determined entirely from the method descriptor (contrast this with the instruction for calling virtual methods, where the destination address also depends upon the runtime type of the instance reference pushed before the ).
+
+ The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. There are three important special cases:
+
+ 1. Calls to an instance (or virtual) method must push that instance reference before any of the user-visible arguments. The instance reference must not be a null reference. The signature carried in the metadata does not contain an entry in the parameter list for the `this` pointer; instead, it uses a bit to indicate whether the method requires passing the `this` pointer.
+
+ 2. It is valid to call a virtual method using `call` (rather than `callvirt`); this indicates that the method is to be resolved using the class specified by method rather than as specified dynamically from the object being invoked.
+
+ 3. Note that a delegate's `Invoke` method can be called with either the `call` or `callvirt` instruction.
+
+ may be thrown if system security does not grant the caller access to the called method. The security check may occur when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at run time.
+
> [!NOTE]
-> When calling methods of System.Object on value types, consider using the `constrained` prefix with the `callvirt` instruction instead of emitting a `call` instruction. This removes the need to emit different IL depending on whether or not the value type overrides the method, avoiding a potential versioning problem. Consider using the `constrained` prefix when invoking interface methods on value types, since the value type method implementing the interface method can be changed using a `MethodImpl`. These issues are described in more detail in the opcode.
-
- The following method overloads can use the `call` opcode:
-
--
-
+> When calling methods of System.Object on value types, consider using the `constrained` prefix with the `callvirt` instruction instead of emitting a `call` instruction. This removes the need to emit different IL depending on whether or not the value type overrides the method, avoiding a potential versioning problem. Consider using the `constrained` prefix when invoking interface methods on value types, since the value type method implementing the interface method can be changed using a `MethodImpl`. These issues are described in more detail in the opcode.
+
+ The following method overloads can use the `call` opcode:
+
+-
+
-
-
+
-
-
+
> [!NOTE]
-> The method is provided for `varargs` calls. Use the method for normal calls.
-
+> The method is provided for `varargs` calls. Use the method for normal calls.
+
]]>
@@ -2500,41 +2499,41 @@
Calls the method indicated on the evaluation stack (as a pointer to an entry point) with arguments described by a calling convention.
- |calli `callSiteDescr`|Calls the method pointed to with arguments described by the calling convention.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. Method arguments `arg1` through `argN` are pushed onto the stack.
-
-2. The method entry pointer is pushed onto the stack.
-
-3. Method arguments `arg1` through `argN` and the method entry pointer are popped from the stack; the call to the method is performed. When complete, a return value is generated by the callee method and sent to the caller.
-
-4. The return value is pushed onto the stack.
-
- The `calli` instruction calls the method entry pointer with the arguments `arg1` through `argN`. The types of these arguments are described by the specific calling convention (`callSiteDesc`). The `calli` instruction may be immediately preceded by a `tail` prefix () to specify that the current method state should be released before transferring control. If the call would transfer control to a method of higher trust than the origin method the stack frame will not be released; instead, the execution will continue silently as if the `tail` had not been supplied.
-
- The method entry pointer is assumed to be a specific pointer to native code (of the target machine) that can be legitimately called with the arguments described by the calling convention (a metadata token for a stand-alone signature). Such a pointer can be created using the or instructions, or passed in from native code.
-
- The calling convention is not checked dynamically, so code that uses a `calli` instruction does not work correctly if the destination does not actually use the specified calling convention.
-
- The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. The argument-building code sequence for an instance or virtual method must push that instance reference (which must not be a null reference) before any of the user-visible arguments.
-
- may be thrown if the system security does not grant the caller access to the called method. The security check can occur when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at runtime.
-
- The following methods can be used to perform a `calli` instruction on the stack. Note that `calli` should be called through the below methods rather than using the class to place the instruction directly on the stack.
-
-- for calls using a managed calling convention.
-
-- for calls using an unmanaged calling convention.
-
+ |calli `callSiteDescr`|Calls the method pointed to with arguments described by the calling convention.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. Method arguments `arg1` through `argN` are pushed onto the stack.
+
+2. The method entry pointer is pushed onto the stack.
+
+3. Method arguments `arg1` through `argN` and the method entry pointer are popped from the stack; the call to the method is performed. When complete, a return value is generated by the callee method and sent to the caller.
+
+4. The return value is pushed onto the stack.
+
+ The `calli` instruction calls the method entry pointer with the arguments `arg1` through `argN`. The types of these arguments are described by the specific calling convention (`callSiteDesc`). The `calli` instruction may be immediately preceded by a `tail` prefix () to specify that the current method state should be released before transferring control. If the call would transfer control to a method of higher trust than the origin method the stack frame will not be released; instead, the execution will continue silently as if the `tail` had not been supplied.
+
+ The method entry pointer is assumed to be a specific pointer to native code (of the target machine) that can be legitimately called with the arguments described by the calling convention (a metadata token for a stand-alone signature). Such a pointer can be created using the or instructions, or passed in from native code.
+
+ The calling convention is not checked dynamically, so code that uses a `calli` instruction does not work correctly if the destination does not actually use the specified calling convention.
+
+ The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. The argument-building code sequence for an instance or virtual method must push that instance reference (which must not be a null reference) before any of the user-visible arguments.
+
+ may be thrown if the system security does not grant the caller access to the called method. The security check can occur when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at runtime.
+
+ The following methods can be used to perform a `calli` instruction on the stack. Note that `calli` should be called through the below methods rather than using the class to place the instruction directly on the stack.
+
+- for calls using a managed calling convention.
+
+- for calls using an unmanaged calling convention.
+
]]>
@@ -2578,50 +2577,50 @@
Calls a late-bound method on an object, pushing the return value onto the evaluation stack.
- |callvirt `method`|Calls a specific method associated with `obj`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference `obj` is pushed onto the stack.
-
-2. Method arguments `arg1` through `argN` are pushed onto the stack.
-
-3. Method arguments `arg1` through `argN` and the object reference `obj` are popped from the stack; the method call is performed with these arguments and control is transferred to the method in `obj` referred to by the method metadata token. When complete, a return value is generated by the callee method and sent to the caller.
-
-4. The return value is pushed onto the stack.
-
- The `callvirt` instruction calls a late-bound method on an object. That is, the method is chosen based on the runtime type of `obj` rather than the compile-time class visible in the method pointer. `Callvirt` can be used to call both virtual and instance methods. The `callvirt` instruction may be immediately preceded by a `tail` () prefix to specify that the current stack frame should be released before transferring control. If the call would transfer control to a method of higher trust than the original method the stack frame will not be released.
-
- The method metadata token provides the name, class and signature of the method to call. The class associated with `obj` is the class of which it is an instance. If the class defines a non-static method that matches the indicated method name and signature, this method is called. Otherwise all classes in the base class chain of this class are checked in order. It is an error if no method is found.
-
- `Callvirt` pops the object and the associated arguments off the evaluation stack before calling the method. If the method has a return value, it is pushed on the stack upon method completion. On the callee side, the `obj` parameter is accessed as argument 0, `arg1` as argument 1, and so on.
-
- The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. The instance reference `obj` (always required for `callvirt`) must be pushed before any of the user-visible arguments. The signature (carried in the metadata token) need not contain an entry in the parameter list for the this pointer.
-
- Note that a virtual method can also be called using the instruction.
-
- is thrown if a non-static method with the indicated name and signature could not be found in the class associated with `obj` or any of its base classes. This is typically detected when Microsoft Intermediate Language (MSIL) instructions are converted to native code, rather than at runtime.
-
- is thrown if obj is null.
-
- is thrown if system security does not grant the caller access to the called method. The security check may occur when the CIL is converted to native code rather than at run time.
-
+ |callvirt `method`|Calls a specific method associated with `obj`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference `obj` is pushed onto the stack.
+
+2. Method arguments `arg1` through `argN` are pushed onto the stack.
+
+3. Method arguments `arg1` through `argN` and the object reference `obj` are popped from the stack; the method call is performed with these arguments and control is transferred to the method in `obj` referred to by the method metadata token. When complete, a return value is generated by the callee method and sent to the caller.
+
+4. The return value is pushed onto the stack.
+
+ The `callvirt` instruction calls a late-bound method on an object. That is, the method is chosen based on the runtime type of `obj` rather than the compile-time class visible in the method pointer. `Callvirt` can be used to call both virtual and instance methods. The `callvirt` instruction may be immediately preceded by a `tail` () prefix to specify that the current stack frame should be released before transferring control. If the call would transfer control to a method of higher trust than the original method the stack frame will not be released.
+
+ The method metadata token provides the name, class and signature of the method to call. The class associated with `obj` is the class of which it is an instance. If the class defines a non-static method that matches the indicated method name and signature, this method is called. Otherwise all classes in the base class chain of this class are checked in order. It is an error if no method is found.
+
+ `Callvirt` pops the object and the associated arguments off the evaluation stack before calling the method. If the method has a return value, it is pushed on the stack upon method completion. On the callee side, the `obj` parameter is accessed as argument 0, `arg1` as argument 1, and so on.
+
+ The arguments are placed on the stack in left-to-right order. That is, the first argument is computed and placed on the stack, then the second argument, then the third, until all necessary arguments are atop the stack in descending order. The instance reference `obj` (always required for `callvirt`) must be pushed before any of the user-visible arguments. The signature (carried in the metadata token) need not contain an entry in the parameter list for the this pointer.
+
+ Note that a virtual method can also be called using the instruction.
+
+ is thrown if a non-static method with the indicated name and signature could not be found in the class associated with `obj` or any of its base classes. This is typically detected when Microsoft Intermediate Language (MSIL) instructions are converted to native code, rather than at runtime.
+
+ is thrown if obj is null.
+
+ is thrown if system security does not grant the caller access to the called method. The security check may occur when the CIL is converted to native code rather than at run time.
+
> [!NOTE]
-> When calling methods of System.Object on value types, consider using the `constrained` prefix with the `callvirt` instruction. This removes the need to emit different IL depending on whether or not the value type overrides the method, avoiding a potential versioning problem. Consider using the `constrained` prefix when invoking interface methods on value types, since the value type method implementing the interface method can be changed using a `MethodImpl`. These issues are described in more detail in the opcode.
-
- The following method overload can use the `callvirt` opcode:
-
--
-
--
-
+> When calling methods of System.Object on value types, consider using the `constrained` prefix with the `callvirt` instruction. This removes the need to emit different IL depending on whether or not the value type overrides the method, avoiding a potential versioning problem. Consider using the `constrained` prefix when invoking interface methods on value types, since the value type method implementing the interface method can be changed using a `MethodImpl`. These issues are described in more detail in the opcode.
+
+ The following method overload can use the `callvirt` opcode:
+
+-
+
+-
+
]]>
@@ -2671,33 +2670,33 @@
Attempts to cast an object passed by reference to the specified class.
- |castclass `class`|Casts an object to a new object of type `class`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference is pushed onto the stack.
-
-2. The object reference is popped from the stack; the referenced object is cast as the specified `class`.
-
-3. If successful, a new object reference is pushed onto the stack.
-
- The `castclass` instruction attempts to cast the object reference (type `O`) atop the stack to a specified class. The new class is specified by a metadata token indicating the desired class. If the class of the object on the top of the stack does not implement the new class (assuming the new class is an interface) and is not a derived class of the new class then an is thrown. If the object reference is a null reference, `castclass` succeeds and returns the new object as a null reference.
-
- is thrown if obj cannot be cast to class.
-
- is thrown if class cannot be found. This is typically detected when a Microsoft Intermediate Language (MSIL) instruction is converted to native code rather than at runtime.
-
- The following method overload can use the `castclass` opcode:
-
--
-
+ |castclass `class`|Casts an object to a new object of type `class`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference is pushed onto the stack.
+
+2. The object reference is popped from the stack; the referenced object is cast as the specified `class`.
+
+3. If successful, a new object reference is pushed onto the stack.
+
+ The `castclass` instruction attempts to cast the object reference (type `O`) atop the stack to a specified class. The new class is specified by a metadata token indicating the desired class. If the class of the object on the top of the stack does not implement the new class (assuming the new class is an interface) and is not a derived class of the new class then an is thrown. If the object reference is a null reference, `castclass` succeeds and returns the new object as a null reference.
+
+ is thrown if obj cannot be cast to class.
+
+ is thrown if class cannot be found. This is typically detected when a Microsoft Intermediate Language (MSIL) instruction is converted to native code rather than at runtime.
+
+ The following method overload can use the `castclass` opcode:
+
+-
+
]]>
@@ -2741,33 +2740,33 @@
Compares two values. If they are equal, the integer value 1 ) is pushed onto the evaluation stack; otherwise 0 () is pushed onto the evaluation stack.
- method overload can use the `ceq` opcode:
-
--
-
+ method overload can use the `ceq` opcode:
+
+-
+
]]>
@@ -2811,33 +2810,33 @@
Compares two values. If the first value is greater than the second, the integer value 1 ) is pushed onto the evaluation stack; otherwise 0 () is pushed onto the evaluation stack.
- method overload can use the `cgt` opcode:
-
--
-
+ method overload can use the `cgt` opcode:
+
+-
+
]]>
@@ -2881,37 +2880,37 @@
Compares two unsigned or unordered values. If the first value is greater than the second, the integer value 1 ) is pushed onto the evaluation stack; otherwise 0 () is pushed onto the evaluation stack.
- method overload can use the `cgt.un` opcode:
-
--
-
+ method overload can use the `cgt.un` opcode:
+
+-
+
]]>
@@ -2955,43 +2954,43 @@
Throws if value is not a finite number.
- if value is not a finite number.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. `value` is pushed onto the stack.
-
-2. `value` is popped from the stack and the `ckfinite` instruction is performed on it.
-
-3. `value` is pushed back onto the stack if no exception is thrown.
-
- The `ckfinite instruction` throws if `value` (a floating-point number) is either a "not a number" value (NaN) or a `+-` infinity value. `Ckfinite` leaves the value on the stack if no exception is thrown. Execution is unspecified if `value` is not a floating-point number.
-
- is thrown if `value` is not a 'normal' number.
-
- Note that a special exception or a derived class of may be more appropriate, passing the incorrect value to the exception handler.
-
- The following method overload can use the `ckfinite` opcode:
-
--
-
- ]]>
-
-
-
-
-
-
-
-
-
+ if value is not a finite number.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. `value` is pushed onto the stack.
+
+2. `value` is popped from the stack and the `ckfinite` instruction is performed on it.
+
+3. `value` is pushed back onto the stack if no exception is thrown.
+
+ The `ckfinite instruction` throws if `value` (a floating-point number) is either a "not a number" value (NaN) or a `+-` infinity value. `Ckfinite` leaves the value on the stack if no exception is thrown. Execution is unspecified if `value` is not a floating-point number.
+
+ is thrown if `value` is not a 'normal' number.
+
+ Note that a special exception or a derived class of may be more appropriate, passing the incorrect value to the exception handler.
+
+ The following method overload can use the `ckfinite` opcode:
+
+-
+
+ ]]>
+
+
+
+
+
+
+
+
+ Field
@@ -3025,33 +3024,33 @@
Compares two values. If the first value is less than the second, the integer value 1 ) is pushed onto the evaluation stack; otherwise 0 () is pushed onto the evaluation stack.
- method overload can use the `clt` opcode:
-
--
-
+ method overload can use the `clt` opcode:
+
+-
+
]]>
@@ -3095,39 +3094,39 @@
Compares the unsigned or unordered values and . If is less than , then the integer value 1 ) is pushed onto the evaluation stack; otherwise 0 () is pushed onto the evaluation stack.
- method overload can use the `clt.un` opcode:
-
--
-
+ method overload can use the `clt.un` opcode:
+
+-
+
]]>
@@ -3170,47 +3169,47 @@
Constrains the type on which a virtual method call is made.
- |constrained. `thisType`|Call a virtual method on a type constrained to be type `T`.|
-
- The `constrained` prefix is permitted only on a `callvirt` instruction.
-
- The state of the MSIL stack at this point must be as follows:
-
-1. A managed pointer, `ptr`, is pushed onto the stack. The type of `ptr` must be a managed pointer (`&`) to `thisType`. Note that this is different from the case of an unprefixed `callvirt` instruction, which expects a reference of `thisType`.
-
-2. Method arguments `arg1` through `argN` are pushed onto the stack, just as with an unprefixed `callvirt` instruction.
-
- The `constrained` prefix is designed to allow `callvirt` instructions to be made in a uniform way independent of whether `thisType` is a value type or a reference type.
-
- When a `callvirt` `method` instruction has been prefixed by `constrained` `thisType`, the instruction is executed as follows:
-
-- If `thisType` is a reference type (as opposed to a value type) then `ptr` is dereferenced and passed as the 'this' pointer to the `callvirt` of `method`.
-
-- If `thisType` is a value type and `thisType` implements `method` then `ptr` is passed unmodified as the 'this' pointer to a `call` `method` instruction, for the implementation of `method` by `thisType`.
-
-- If `thisType` is a value type and `thisType` does not implement `method` then `ptr` is dereferenced, boxed, and passed as the 'this' pointer to the `callvirt` `method` instruction.
-
- This last case can occur only when `method` was defined on , , or and not overridden by `thisType`. In this case, the boxing causes a copy of the original object to be made. However, because none of the methods of , , and modify the state of the object, this fact cannot be detected.
-
- The `constrained` prefix supports IL generators that create generic code. Normally the `callvirt` instruction is not valid on value types. Instead it is required that IL compilers effectively perform the 'this' transformation outlined above at compile time, depending on the type of `ptr` and the method being called. However, when `ptr` is a generic type that is unknown at compile time, it is not possible to make this transformation at compile time.
-
- The `constrained` opcode allows IL compilers to make a call to a virtual function in a uniform way independent of whether `ptr` is a value type or a reference type. Although it is intended for the case where `thisType` is a generic type variable, the `constrained` prefix also works for nongeneric types and can reduce the complexity of generating virtual calls in languages that hide the distinction between value types and reference types.
-
- Using the `constrained` prefix also avoids potential versioning problems with value types. If the `constrained` prefix is not used, different IL must be emitted depending on whether or not a value type overrides a method of System.Object. For example, if a value type `V` overrides the Object.ToString() method, a `call` `V.ToString()` instruction is emitted; if it does not, a `box` instruction and a `callvirt` `Object.ToString()` instruction are emitted. A versioning problem can arise in the former case if the override is later removed, and in the latter case if an override is later added.
-
- The `constrained` prefix can also be used for invocation of interface methods on value types, because the value type method implementing the interface method can be changed using a `MethodImpl`. If the `constrained` prefix is not used, the compiler is forced to choose which of the value type's methods to bind to at compile time. Using the `constrained` prefix allows the MSIL to bind to the method that implements the interface method at run time, rather than at compile time.
-
- The following method overload can use the `constrained` opcode:
-
--
-
+ |constrained. `thisType`|Call a virtual method on a type constrained to be type `T`.|
+
+ The `constrained` prefix is permitted only on a `callvirt` instruction.
+
+ The state of the MSIL stack at this point must be as follows:
+
+1. A managed pointer, `ptr`, is pushed onto the stack. The type of `ptr` must be a managed pointer (`&`) to `thisType`. Note that this is different from the case of an unprefixed `callvirt` instruction, which expects a reference of `thisType`.
+
+2. Method arguments `arg1` through `argN` are pushed onto the stack, just as with an unprefixed `callvirt` instruction.
+
+ The `constrained` prefix is designed to allow `callvirt` instructions to be made in a uniform way independent of whether `thisType` is a value type or a reference type.
+
+ When a `callvirt` `method` instruction has been prefixed by `constrained` `thisType`, the instruction is executed as follows:
+
+- If `thisType` is a reference type (as opposed to a value type) then `ptr` is dereferenced and passed as the 'this' pointer to the `callvirt` of `method`.
+
+- If `thisType` is a value type and `thisType` implements `method` then `ptr` is passed unmodified as the 'this' pointer to a `call` `method` instruction, for the implementation of `method` by `thisType`.
+
+- If `thisType` is a value type and `thisType` does not implement `method` then `ptr` is dereferenced, boxed, and passed as the 'this' pointer to the `callvirt` `method` instruction.
+
+ This last case can occur only when `method` was defined on , , or and not overridden by `thisType`. In this case, the boxing causes a copy of the original object to be made. However, because none of the methods of , , and modify the state of the object, this fact cannot be detected.
+
+ The `constrained` prefix supports IL generators that create generic code. Normally the `callvirt` instruction is not valid on value types. Instead it is required that IL compilers effectively perform the 'this' transformation outlined above at compile time, depending on the type of `ptr` and the method being called. However, when `ptr` is a generic type that is unknown at compile time, it is not possible to make this transformation at compile time.
+
+ The `constrained` opcode allows IL compilers to make a call to a virtual function in a uniform way independent of whether `ptr` is a value type or a reference type. Although it is intended for the case where `thisType` is a generic type variable, the `constrained` prefix also works for nongeneric types and can reduce the complexity of generating virtual calls in languages that hide the distinction between value types and reference types.
+
+ Using the `constrained` prefix also avoids potential versioning problems with value types. If the `constrained` prefix is not used, different IL must be emitted depending on whether or not a value type overrides a method of System.Object. For example, if a value type `V` overrides the Object.ToString() method, a `call` `V.ToString()` instruction is emitted; if it does not, a `box` instruction and a `callvirt` `Object.ToString()` instruction are emitted. A versioning problem can arise in the former case if the override is later removed, and in the latter case if an override is later added.
+
+ The `constrained` prefix can also be used for invocation of interface methods on value types, because the value type method implementing the interface method can be changed using a `MethodImpl`. If the `constrained` prefix is not used, the compiler is forced to choose which of the value type's methods to bind to at compile time. Using the `constrained` prefix allows the MSIL to bind to the method that implements the interface method at run time, rather than at compile time.
+
+ The following method overload can use the `constrained` opcode:
+
+-
+
]]>
@@ -3254,35 +3253,35 @@
Converts the value on top of the evaluation stack to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.i` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.i` opcode:
+
+-
+
]]>
@@ -3326,35 +3325,35 @@
Converts the value on top of the evaluation stack to , then extends (pads) it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.i1` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.i1` opcode:
+
+-
+
]]>
@@ -3398,35 +3397,35 @@
Converts the value on top of the evaluation stack to , then extends (pads) it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.i2` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.i2` opcode:
+
+-
+
]]>
@@ -3470,35 +3469,35 @@
Converts the value on top of the evaluation stack to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.i4` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.i4` opcode:
+
+-
+
]]>
@@ -3542,35 +3541,35 @@
Converts the value on top of the evaluation stack to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.i8` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.i8` opcode:
+
+-
+
]]>
@@ -3614,33 +3613,33 @@
Converts the signed value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i` opcode:
+
+-
+
]]>
@@ -3684,33 +3683,33 @@
Converts the unsigned value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i.un` opcode:
+
+-
+
]]>
@@ -3754,33 +3753,33 @@
Converts the signed value on top of the evaluation stack to signed and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i1` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i1` opcode:
+
+-
+
]]>
@@ -3824,33 +3823,33 @@
Converts the unsigned value on top of the evaluation stack to signed and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i1.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i1.un` opcode:
+
+-
+
]]>
@@ -3894,33 +3893,33 @@
Converts the signed value on top of the evaluation stack to signed and extending it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i2` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i2` opcode:
+
+-
+
]]>
@@ -3964,33 +3963,33 @@
Converts the unsigned value on top of the evaluation stack to signed and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i2.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i2.un` opcode:
+
+-
+
]]>
@@ -4034,33 +4033,33 @@
Converts the signed value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i4` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i4` opcode:
+
+-
+
]]>
@@ -4104,33 +4103,33 @@
Converts the unsigned value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i4.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i4.un` opcode:
+
+-
+
]]>
@@ -4174,33 +4173,33 @@
Converts the signed value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i8` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i8` opcode:
+
+-
+
]]>
@@ -4244,33 +4243,33 @@
Converts the unsigned value on top of the evaluation stack to signed , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.i8.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.i8.un` opcode:
+
+-
+
]]>
@@ -4314,36 +4313,36 @@
Converts the signed value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u` opcode:
-
--
-
- ]]>
-
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u` opcode:
+
+-
+
+ ]]>
+
+
@@ -4384,33 +4383,33 @@
Converts the unsigned value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.uvf.u.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.uvf.u.un` opcode:
+
+-
+
]]>
@@ -4454,33 +4453,33 @@
Converts the signed value on top of the evaluation stack to and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u1` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u1` opcode:
+
+-
+
]]>
@@ -4524,33 +4523,33 @@
Converts the unsigned value on top of the evaluation stack to and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u1.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u1.un` opcode:
+
+-
+
]]>
@@ -4594,33 +4593,33 @@
Converts the signed value on top of the evaluation stack to and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u2` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u2` opcode:
+
+-
+
]]>
@@ -4664,33 +4663,33 @@
Converts the unsigned value on top of the evaluation stack to and extends it to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u2.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u2.un` opcode:
+
+-
+
]]>
@@ -4734,33 +4733,33 @@
Converts the signed value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u4` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u4` opcode:
+
+-
+
]]>
@@ -4804,33 +4803,33 @@
Converts the unsigned value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u4.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u4.un` opcode:
+
+-
+
]]>
@@ -4874,33 +4873,33 @@
Converts the signed value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u8` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u8` opcode:
+
+-
+
]]>
@@ -4944,33 +4943,33 @@
Converts the unsigned value on top of the evaluation stack to , throwing on overflow.
- is thrown if the result can not be represented in the result type.
-
- The following method overload can use the `conv.ovf.u8.un` opcode:
-
--
-
+ is thrown if the result can not be represented in the result type.
+
+ The following method overload can use the `conv.ovf.u8.un` opcode:
+
+-
+
]]>
@@ -5014,35 +5013,35 @@
Converts the unsigned integer value on top of the evaluation stack to .
- method overload can use the `conv.r.un` opcode:
-
--
-
+ method overload can use the `conv.r.un` opcode:
+
+-
+
]]>
@@ -5086,35 +5085,35 @@
Converts the value on top of the evaluation stack to .
- method overload can use the `conv.r4` opcode:
-
--
-
+ method overload can use the `conv.r4` opcode:
+
+-
+
]]>
@@ -5158,35 +5157,35 @@
Converts the value on top of the evaluation stack to .
- method overload can use the `conv.r8` opcode:
-
--
-
+ method overload can use the `conv.r8` opcode:
+
+-
+
]]>
@@ -5230,35 +5229,35 @@
Converts the value on top of the evaluation stack to , and extends it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.u` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.u` opcode:
+
+-
+
]]>
@@ -5302,35 +5301,35 @@
Converts the value on top of the evaluation stack to , and extends it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.u1` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.u1` opcode:
+
+-
+
]]>
@@ -5374,35 +5373,35 @@
Converts the value on top of the evaluation stack to , and extends it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.u2` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.u2` opcode:
+
+-
+
]]>
@@ -5446,35 +5445,35 @@
Converts the value on top of the evaluation stack to , and extends it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.u4` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.u4` opcode:
+
+-
+
]]>
@@ -5518,35 +5517,35 @@
Converts the value on top of the evaluation stack to , and extends it to .
- and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
-
- The following method overload can use the `conv.u8` opcode:
-
--
-
+ and for equivalent instructions that will throw an exception when the result type can not properly represent the result value.
+
+ The following method overload can use the `conv.u8` opcode:
+
+-
+
]]>
@@ -5590,37 +5589,37 @@
Copies a specified number bytes from a source address to a destination address.
- ` instruction to indicate that either the source or the destination is unaligned.
-
- The operation of the `cpblk` instruction can be altered by an immediately preceding or prefix instruction.
-
- may be thrown if an invalid address is detected.
-
- The following method overload can use the `cpblk` opcode:
-
--
-
+ ` instruction to indicate that either the source or the destination is unaligned.
+
+ The operation of the `cpblk` instruction can be altered by an immediately preceding or prefix instruction.
+
+ may be thrown if an invalid address is detected.
+
+ The following method overload can use the `cpblk` opcode:
+
+-
+
]]>
@@ -5664,31 +5663,31 @@
Copies the value type located at the address of an object (type , or ) to the address of the destination object (type , or ).
- |cpobj `classTok`|Copies a value type from a source object to a destination object.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The destination object reference is pushed onto the stack.
-
-2. The source object reference is pushed onto the stack.
-
-3. The two object references are popped from the stack; the value type at the address of the source object is copied to the address of the destination object.
-
- The behavior of `cpobj` is unspecified if the source and destination object references are not pointers to instances of the class represented by the class token `classTok` (a `typeref` or `typedef`), or if `classTok` does not represent a value type.
-
- may be thrown if an invalid address is detected.
-
- The following method overload can use the `cpobj` opcode:
-
--
-
+ |cpobj `classTok`|Copies a value type from a source object to a destination object.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The destination object reference is pushed onto the stack.
+
+2. The source object reference is pushed onto the stack.
+
+3. The two object references are popped from the stack; the value type at the address of the source object is copied to the address of the destination object.
+
+ The behavior of `cpobj` is unspecified if the source and destination object references are not pointers to instances of the class represented by the class token `classTok` (a `typeref` or `typedef`), or if `classTok` does not represent a value type.
+
+ may be thrown if an invalid address is detected.
+
+ The following method overload can use the `cpobj` opcode:
+
+-
+
]]>
@@ -5732,53 +5731,53 @@
Divides two values and pushes the result as a floating-point (type ) or quotient (type ) onto the evaluation stack.
- if the result cannot be represented in the result type. This can happen if `value1` is the maximum negative value, and `value2` is -1.
-
- Integral operations throw if `value2` is zero.
-
- Note that on Intel-based platforms an is thrown when computing (minint div -1). Floating-point operations never throw an exception (they produce NaNs or infinities instead).
-
- The following method overload can use the `div` opcode:
-
--
-
- ]]>
-
-
-
+ if the result cannot be represented in the result type. This can happen if `value1` is the maximum negative value, and `value2` is -1.
+
+ Integral operations throw if `value2` is zero.
+
+ Note that on Intel-based platforms an is thrown when computing (minint div -1). Floating-point operations never throw an exception (they produce NaNs or infinities instead).
+
+ The following method overload can use the `div` opcode:
+
+-
+
+ ]]>
+
+
+
@@ -5818,31 +5817,31 @@
Divides two unsigned integer values and pushes the result () onto the evaluation stack.
- method overload can use the `div.un` opcode:
-
--
-
+ method overload can use the `div.un` opcode:
+
+-
+
]]>
@@ -5886,31 +5885,31 @@
Copies the current topmost value on the evaluation stack, and then pushes the copy onto the evaluation stack.
- method overload can use the `dup` opcode:
-
--
-
+ method overload can use the `dup` opcode:
+
+-
+
]]>
@@ -5954,37 +5953,37 @@
Transfers control from the clause of an exception back to the Common Language Infrastructure (CLI) exception handler.
- method overload can use the `endfilter` opcode:
-
--
-
+ method overload can use the `endfilter` opcode:
+
+-
+
]]>
@@ -6028,31 +6027,31 @@
Transfers control from the or clause of an exception block back to the Common Language Infrastructure (CLI) exception handler.
- endfault|Ends the `finally` or `fault` clause of an exception block.|
-
- There are no stack transition behaviors for this instruction.
-
- `Endfinally` and `endfault` signal the end of the `finally` or `fault` clause so that stack unwinding can continue until the exception handler is invoked. The `endfinally` or `endfault` instruction transfers control back to the CLI exception mechanism. The mechanism then searches for the next `finally` clause in the chain if the protected block was exited with a leave instruction. If the protected block was exited with an exception, the CLI will search for the next `finally` or `fault`, or enter the exception handler chosen during the first pass of exception handling.
-
- An `endfinally` instruction might only appear lexically within a `finally` block. Unlike the `endfilter` instruction, there is no requirement that the block end with an `endfinally` instruction, and there can be as many `endfinally` instructions within the block as required. These same restrictions apply to the `endfault` instruction and the `fault` block.
-
- Control cannot be transferred into a `finally` (or `fault`) block except through the exception mechanism. Control cannot be transferred out of a `finally` (or `fault`) block except through the use of a `throw` instruction or executing the `endfinally` (or `endfault`) instruction. In particular, you cannot "fall out" of a `finally` (or `fault`) block or to execute a or instruction within a `finally` (or `fault`) block.
-
- Note that the `endfault` and `endfinally` instructions are aliases - they correspond to the same opcode.
-
- The following method overload can use the `endfinally` (`endfault`) opcode, as well as the `ILGenerator` method .
-
--
-
--
-
+ endfault|Ends the `finally` or `fault` clause of an exception block.|
+
+ There are no stack transition behaviors for this instruction.
+
+ `Endfinally` and `endfault` signal the end of the `finally` or `fault` clause so that stack unwinding can continue until the exception handler is invoked. The `endfinally` or `endfault` instruction transfers control back to the CLI exception mechanism. The mechanism then searches for the next `finally` clause in the chain if the protected block was exited with a leave instruction. If the protected block was exited with an exception, the CLI will search for the next `finally` or `fault`, or enter the exception handler chosen during the first pass of exception handling.
+
+ An `endfinally` instruction might only appear lexically within a `finally` block. Unlike the `endfilter` instruction, there is no requirement that the block end with an `endfinally` instruction, and there can be as many `endfinally` instructions within the block as required. These same restrictions apply to the `endfault` instruction and the `fault` block.
+
+ Control cannot be transferred into a `finally` (or `fault`) block except through the exception mechanism. Control cannot be transferred out of a `finally` (or `fault`) block except through the use of a `throw` instruction or executing the `endfinally` (or `endfault`) instruction. In particular, you cannot "fall out" of a `finally` (or `fault`) block or to execute a or instruction within a `finally` (or `fault`) block.
+
+ Note that the `endfault` and `endfinally` instructions are aliases - they correspond to the same opcode.
+
+ The following method overload can use the `endfinally` (`endfault`) opcode, as well as the `ILGenerator` method .
+
+-
+
+-
+
]]>
@@ -6096,35 +6095,35 @@
Initializes a specified block of memory at a specific address to a given size and initial value.
- or prefix instruction.
-
- may be thrown if an invalid address is detected.
-
- The following method overload can use the `initblk` opcode:
-
--
-
+ or prefix instruction.
+
+ may be thrown if an invalid address is detected.
+
+ The following method overload can use the `initblk` opcode:
+
+-
+
]]>
@@ -6168,29 +6167,29 @@
Initializes each field of the value type at a specified address to a null reference or a 0 of the appropriate primitive type.
- |`initobj` `typeTok`|Initializes a value type.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The address of the value type to initialize is pushed onto the stack.
-
-2. The address is popped from the stack; the value type at the specified address is initialized as type `typeTok`.
-
- The `initobj` instruction initializes each field of the value type specified by the pushed address (of type `native int`, `&`, or `*`) to a null reference or a 0 of the appropriate primitive type. After this method is called, the instance is ready for a constructor method to be called. If `typeTok` is a reference type, this instruction has the same effect as `ldnull` followed by `stind.ref`.
-
- Unlike , `initobj` does not call the constructor method. `Initobj` is intended for initializing value types, while `newobj` is used to allocate and initialize objects.
-
- The following method overload can use the `initobj` opcode:
-
--
-
+ |`initobj` `typeTok`|Initializes a value type.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The address of the value type to initialize is pushed onto the stack.
+
+2. The address is popped from the stack; the value type at the specified address is initialized as type `typeTok`.
+
+ The `initobj` instruction initializes each field of the value type specified by the pushed address (of type `native int`, `&`, or `*`) to a null reference or a 0 of the appropriate primitive type. After this method is called, the instance is ready for a constructor method to be called. If `typeTok` is a reference type, this instruction has the same effect as `ldnull` followed by `stind.ref`.
+
+ Unlike , `initobj` does not call the constructor method. `Initobj` is intended for initializing value types, while `newobj` is used to allocate and initialize objects.
+
+ The following method overload can use the `initobj` opcode:
+
+-
+
]]>
@@ -6234,31 +6233,31 @@
Tests whether an object reference (type ) is an instance of a particular class.
- |isinst `class`|Tests if an object reference is an instance of `class`, returning either a null reference or an instance of that class or interface.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference is pushed onto the stack.
-
-2. The object reference is popped from the stack and tested to see if it is an instance of the class passed in `class`.
-
-3. The result (either an object reference or a null reference) is pushed onto the stack.
-
- `Class` is a metadata token indicating the desired class. If the class of the object on the top of the stack implements `class` (if `class` is an interface) or is a derived class of `class` (if `class` is a regular class) then it is cast to type `class` and the result is pushed on the stack, exactly as though had been called. Otherwise, a null reference is pushed on the stack. If the object reference itself is a null reference, then `isinst` likewise returns a null reference.
-
- is thrown if class cannot be found. This is typically detected when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at runtime.
-
- The following method overload can use the `isinst` opcode:
-
--
-
+ |isinst `class`|Tests if an object reference is an instance of `class`, returning either a null reference or an instance of that class or interface.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference is pushed onto the stack.
+
+2. The object reference is popped from the stack and tested to see if it is an instance of the class passed in `class`.
+
+3. The result (either an object reference or a null reference) is pushed onto the stack.
+
+ `Class` is a metadata token indicating the desired class. If the class of the object on the top of the stack implements `class` (if `class` is an interface) or is a derived class of `class` (if `class` is a regular class) then it is cast to type `class` and the result is pushed on the stack, exactly as though had been called. Otherwise, a null reference is pushed on the stack. If the object reference itself is a null reference, then `isinst` likewise returns a null reference.
+
+ is thrown if class cannot be found. This is typically detected when the Microsoft Intermediate Language (MSIL) instructions are converted to native code rather than at runtime.
+
+ The following method overload can use the `isinst` opcode:
+
+-
+
]]>
@@ -6302,27 +6301,27 @@
Exits current method and jumps to specified method.
- |jmp `method`|Exit current method and jump to specified method.|
-
- There are no stack transition behaviors for this instruction.
-
- The `jmp` (jump) instruction transfers control to the method specified by `method`, which is a metadata token for a method reference. The current arguments are transferred to the destination method.
-
- The evaluation stack must be empty when this instruction is executed. The calling convention, number and type of arguments at the destination address must match that of the current method.
-
- The `jmp` instruction cannot be used to transferred control out of a `try`, `filter`, `catch`, or `finally` block.
-
- The following method overload can use the `jmp` opcode:
-
--
-
+ |jmp `method`|Exit current method and jump to specified method.|
+
+ There are no stack transition behaviors for this instruction.
+
+ The `jmp` (jump) instruction transfers control to the method specified by `method`, which is a metadata token for a method reference. The current arguments are transferred to the destination method.
+
+ The evaluation stack must be empty when this instruction is executed. The calling convention, number and type of arguments at the destination address must match that of the current method.
+
+ The `jmp` instruction cannot be used to transferred control out of a `try`, `filter`, `catch`, or `finally` block.
+
+ The following method overload can use the `jmp` opcode:
+
+-
+
]]>
@@ -6366,29 +6365,29 @@
Loads an argument (referenced by a specified index value) onto the stack.
- |ldarg `index`|Load argument at `index` onto stack.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The argument value at `index` is pushed onto the stack.
-
- The `ldarg` instruction pushes the argument indexed at `index`, where arguments are indexed from 0 onwards, onto the evaluation stack. The `ldarg` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature.
-
- For procedures that take a variable-length argument list, the `ldarg` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature (see the instruction for more details).
-
- Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`).
-
- The following method overload can use the `ldarg` opcode:
-
--
-
+ |ldarg `index`|Load argument at `index` onto stack.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The argument value at `index` is pushed onto the stack.
+
+ The `ldarg` instruction pushes the argument indexed at `index`, where arguments are indexed from 0 onwards, onto the evaluation stack. The `ldarg` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature.
+
+ For procedures that take a variable-length argument list, the `ldarg` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature (see the instruction for more details).
+
+ Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`).
+
+ The following method overload can use the `ldarg` opcode:
+
+-
+
]]>
@@ -6432,29 +6431,29 @@
Loads the argument at index 0 onto the evaluation stack.
- method overload can use the `ldarg.0` opcode:
-
--
-
+ method overload can use the `ldarg.0` opcode:
+
+-
+
]]>
@@ -6498,29 +6497,29 @@
Loads the argument at index 1 onto the evaluation stack.
- method overload can use the `ldarg.1` opcode:
-
--
-
+ method overload can use the `ldarg.1` opcode:
+
+-
+
]]>
@@ -6564,29 +6563,29 @@
Loads the argument at index 2 onto the evaluation stack.
- method overload can use the `ldarg.2` opcode:
-
--
-
+ method overload can use the `ldarg.2` opcode:
+
+-
+
]]>
@@ -6630,29 +6629,29 @@
Loads the argument at index 3 onto the evaluation stack.
- method overload can use the `ldarg.3` opcode:
-
--
-
+ method overload can use the `ldarg.3` opcode:
+
+-
+
]]>
@@ -6696,31 +6695,31 @@
Loads the argument (referenced by a specified short form index) onto the evaluation stack.
- |ldarg.s `index`|Load argument at `index` onto stack, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The argument value at `index` is pushed onto the stack.
-
- The `ldarg.s` instruction is an efficient encoding for loading arguments indexed from 4 through 255.
-
- The `ldarg.s` instruction pushes the argument indexed at `index`, where arguments are indexed from 0 onwards, onto the evaluation stack. The `ldarg.s` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature.
-
- For procedures that take a variable-length argument list, the `ldarg.s` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature (see the instruction for more details).
-
- Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`).
-
- The following method overload can use the `ldarg.s` opcode:
-
--
-
+ |ldarg.s `index`|Load argument at `index` onto stack, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The argument value at `index` is pushed onto the stack.
+
+ The `ldarg.s` instruction is an efficient encoding for loading arguments indexed from 4 through 255.
+
+ The `ldarg.s` instruction pushes the argument indexed at `index`, where arguments are indexed from 0 onwards, onto the evaluation stack. The `ldarg.s` instruction can be used to load a value type or a primitive value onto the stack by copying it from an incoming argument. The type of the argument value is the same as the type of the argument, as specified by the current method's signature.
+
+ For procedures that take a variable-length argument list, the `ldarg.s` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature (see the instruction for more details).
+
+ Arguments that hold an integer value smaller than 4 bytes long are expanded to type `int32` when they are loaded onto the stack. Floating-point values are expanded to their native size (type `F`).
+
+ The following method overload can use the `ldarg.s` opcode:
+
+-
+
]]>
@@ -6764,29 +6763,29 @@
Load an argument address onto the evaluation stack.
- |ldarga `index`|Fetch the address of argument indexed by `index`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The address `addr` of the argument indexed by `index` is pushed onto the stack.
-
+ |ldarga `index`|Fetch the address of argument indexed by `index`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The address `addr` of the argument indexed by `index` is pushed onto the stack.
+
The `ldarga` instruction fetches the address (of type `&`) of the argument indexed by `index`, where arguments are indexed from 0 onwards. The address `addr` is always aligned to a natural boundary on the target machine. The argument is stored in unmanaged memory, so the return value can be converted to an unmanaged pointer without pinning.
-
- For procedures that take a variable-length argument list, the `ldarga` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature.
-
- `ldarga` is used for by-ref parameter passing. For other cases, and should be used.
-
- The following method overload can use the `ldarga` opcode:
-
--
-
+
+ For procedures that take a variable-length argument list, the `ldarga` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature.
+
+ `ldarga` is used for by-ref parameter passing. For other cases, and should be used.
+
+ The following method overload can use the `ldarga` opcode:
+
+-
+
]]>
@@ -6830,31 +6829,31 @@
Load an argument address, in short form, onto the evaluation stack.
- |ldarga.s `index`|Fetch the address of argument indexed by `index`, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The address `addr` of the argument indexed by `index` is pushed onto the stack.
-
- `ldarga.s` (the short form of `ldarga`) should be used for argument numbers 0 through 255, and is a more efficient encoding.
-
- The `ldarga.s` instruction fetches the address (of type`*`) of the argument indexed by `index`, where arguments are indexed from 0 onwards. The address `addr` is always aligned to a natural boundary on the target machine.
-
- For procedures that take a variable-length argument list, the `ldarga.s` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature.
-
- `ldarga.s` is used for by-ref parameter passing. For other cases, and should be used.
-
- The following method overload can use the `ldarga.s` opcode:
-
--
-
+ |ldarga.s `index`|Fetch the address of argument indexed by `index`, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The address `addr` of the argument indexed by `index` is pushed onto the stack.
+
+ `ldarga.s` (the short form of `ldarga`) should be used for argument numbers 0 through 255, and is a more efficient encoding.
+
+ The `ldarga.s` instruction fetches the address (of type`*`) of the argument indexed by `index`, where arguments are indexed from 0 onwards. The address `addr` is always aligned to a natural boundary on the target machine.
+
+ For procedures that take a variable-length argument list, the `ldarga.s` instruction can be used only for the initial fixed arguments, not those in the variable part of the signature.
+
+ `ldarga.s` is used for by-ref parameter passing. For other cases, and should be used.
+
+ The following method overload can use the `ldarga.s` opcode:
+
+-
+
]]>
@@ -6898,31 +6897,31 @@
Pushes a supplied value of type onto the evaluation stack as an .
- |ldc.i4 `num`|Pushes the value `num` onto the stack.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The value `num` is pushed onto the stack.
-
- Note that there are special short (and hence more efficient) encodings for the integers -128 through 127, and especially short encodings for -1 through 8. All short encodings push 4 byte integers on the stack. Longer encodings are used for 8 byte integers and 4 and 8 byte floating-point numbers, as well as 4-byte values that do not fit in the short forms. There are three ways to push an 8 byte integer constant onto the stack
-
- 1. Use the instruction for constants that must be expressed in more than 32 bits.
-
- 2. Use the instruction followed by a for constants that require 9 to 32 bits.
-
- 3. Use a short form instruction followed by a for constants that can be expressed in 8 or fewer bits.
-
- The following method overload can use the `ldc.i4` opcode:
-
--
-
+ |ldc.i4 `num`|Pushes the value `num` onto the stack.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The value `num` is pushed onto the stack.
+
+ Note that there are special short (and hence more efficient) encodings for the integers -128 through 127, and especially short encodings for -1 through 8. All short encodings push 4 byte integers on the stack. Longer encodings are used for 8 byte integers and 4 and 8 byte floating-point numbers, as well as 4-byte values that do not fit in the short forms. There are three ways to push an 8 byte integer constant onto the stack
+
+ 1. Use the instruction for constants that must be expressed in more than 32 bits.
+
+ 2. Use the instruction followed by a for constants that require 9 to 32 bits.
+
+ 3. Use a short form instruction followed by a for constants that can be expressed in 8 or fewer bits.
+
+ The following method overload can use the `ldc.i4` opcode:
+
+-
+
]]>
@@ -6966,25 +6965,25 @@
Pushes the integer value of 0 onto the evaluation stack as an .
- method overload can use the `ldc.i4.0` opcode:
-
--
-
+ method overload can use the `ldc.i4.0` opcode:
+
+-
+
]]>
@@ -7028,25 +7027,25 @@
Pushes the integer value of 1 onto the evaluation stack as an .
- method overload can use the `ldc.i4.1` opcode:
-
--
-
+ method overload can use the `ldc.i4.1` opcode:
+
+-
+
]]>
@@ -7090,25 +7089,25 @@
Pushes the integer value of 2 onto the evaluation stack as an .
- method overload can use the `ldc.i4.2` opcode:
-
--
-
+ method overload can use the `ldc.i4.2` opcode:
+
+-
+
]]>
@@ -7152,25 +7151,25 @@
Pushes the integer value of 3 onto the evaluation stack as an .
- method overload can use the `ldc.i4.3` opcode:
-
--
-
+ method overload can use the `ldc.i4.3` opcode:
+
+-
+
]]>
@@ -7214,25 +7213,25 @@
Pushes the integer value of 4 onto the evaluation stack as an .
- method overload can use the `ldc.i4.4` opcode:
-
--
-
+ method overload can use the `ldc.i4.4` opcode:
+
+-
+
]]>
@@ -7276,25 +7275,25 @@
Pushes the integer value of 5 onto the evaluation stack as an .
- method overload can use the `ldc.i4.5` opcode:
-
--
-
+ method overload can use the `ldc.i4.5` opcode:
+
+-
+
]]>
@@ -7338,26 +7337,26 @@
Pushes the integer value of 6 onto the evaluation stack as an .
- method overload can use the `ldc.i4.6` opcode:
-
--
-
- ]]>
+ method overload can use the `ldc.i4.6` opcode:
+
+-
+
+ ]]>
@@ -7400,25 +7399,25 @@
Pushes the integer value of 7 onto the evaluation stack as an .
- method overload can use the `ldc.i4.7` opcode:
-
--
-
+ method overload can use the `ldc.i4.7` opcode:
+
+-
+
]]>
@@ -7462,25 +7461,25 @@
Pushes the integer value of 8 onto the evaluation stack as an .
- method overload can use the `ldc.i4.8` opcode:
-
--
-
+ method overload can use the `ldc.i4.8` opcode:
+
+-
+
]]>
@@ -7524,25 +7523,25 @@
Pushes the integer value of -1 onto the evaluation stack as an .
- method overload can use the `ldc.i4.m1` opcode:
-
--
-
+ method overload can use the `ldc.i4.m1` opcode:
+
+-
+
]]>
@@ -7586,26 +7585,26 @@
Pushes the supplied value onto the evaluation stack as an , short form.
- |ldc.i4.s `num`|Pushes `num` onto the stack as `int32`, short form.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The value `num` is pushed onto the stack.
-
- `ldc.i4.s` is a more efficient encoding for pushing the integers from -128 to 127 onto the evaluation stack.
-
+ |ldc.i4.s `num`|Pushes `num` onto the stack as `int32`, short form.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The value `num` is pushed onto the stack.
+
+ `ldc.i4.s` is a more efficient encoding for pushing the integers from -128 to 127 onto the evaluation stack.
+
The following method overloads can use the `ldc.i4.s` opcode:
-
+
-
-
-
+
]]>
@@ -7649,25 +7648,25 @@ The following method overloads
Pushes a supplied value of type onto the evaluation stack as an .
- |ldc.i8 `num`|Pushes `num` onto the stack as `int64`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The value `num` is pushed onto the stack.
-
- This encoding pushes an `int64` value onto the stack.
-
- The following method overload can use the `ldc.i8` opcode:
-
--
-
+ |ldc.i8 `num`|Pushes `num` onto the stack as `int64`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The value `num` is pushed onto the stack.
+
+ This encoding pushes an `int64` value onto the stack.
+
+ The following method overload can use the `ldc.i8` opcode:
+
+-
+
]]>
@@ -7711,25 +7710,25 @@ The following method overloads
Pushes a supplied value of type onto the evaluation stack as type (float).
- |ldc.r4 `num`|Pushes `num` onto the stack as `F`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The value `num` is pushed onto the stack.
-
- This encoding pushes a `float32` value onto the stack.
-
- The following method overload can use the `ldc.r4` opcode:
-
--
-
+ |ldc.r4 `num`|Pushes `num` onto the stack as `F`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The value `num` is pushed onto the stack.
+
+ This encoding pushes a `float32` value onto the stack.
+
+ The following method overload can use the `ldc.r4` opcode:
+
+-
+
]]>
@@ -7773,25 +7772,25 @@ The following method overloads
Pushes a supplied value of type onto the evaluation stack as type (float).
- |ldc.r8 `num`|Pushes `num` onto the stack as `F`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The value `num` is pushed onto the stack.
-
- This encoding pushes a `float64` value onto the stack.
-
- The following method overload can use the `ldc.r8` opcode:
-
--
-
+ |ldc.r8 `num`|Pushes `num` onto the stack as `F`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The value `num` is pushed onto the stack.
+
+ This encoding pushes a `float64` value onto the stack.
+
+ The following method overload can use the `ldc.r8` opcode:
+
+-
+
]]>
@@ -7834,37 +7833,37 @@ The following method overloads
Loads the element at a specified array index onto the top of the evaluation stack as the type specified in the instruction.
- |ldelem `typeTok`|Loads the element at `index` onto the top of the stack as type `typeTok`.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference `array` is pushed onto the stack.
-
-2. An index value `index` is pushed onto the stack.
-
-3. `index` and `array` are popped from the stack; the value stored at position `index` in `array` is looked up.
-
-4. The value is pushed onto the stack.
-
- The `ldelem` instruction loads the value of the element with index `index` (type `native int`) in the zero-based one-dimensional array `array` and places it on the top of the stack. Arrays are objects, and hence represented by a value of type `O`.
-
- The type of the return value is specified by the token `typeTok` in the instruction.
-
- is thrown if `array` is a null reference.
-
- is thrown if `index` is negative, or larger than the upper bound of `array`.
-
- The following method overload can use the `ldelem` opcode:
-
--
-
+ |ldelem `typeTok`|Loads the element at `index` onto the top of the stack as type `typeTok`.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference `array` is pushed onto the stack.
+
+2. An index value `index` is pushed onto the stack.
+
+3. `index` and `array` are popped from the stack; the value stored at position `index` in `array` is looked up.
+
+4. The value is pushed onto the stack.
+
+ The `ldelem` instruction loads the value of the element with index `index` (type `native int`) in the zero-based one-dimensional array `array` and places it on the top of the stack. Arrays are objects, and hence represented by a value of type `O`.
+
+ The type of the return value is specified by the token `typeTok` in the instruction.
+
+ is thrown if `array` is a null reference.
+
+ is thrown if `index` is negative, or larger than the upper bound of `array`.
+
+ The following method overload can use the `ldelem` opcode:
+
+-
+
]]>
@@ -7908,41 +7907,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as a .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.i` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.i` opcode:
+
+-
+
]]>
@@ -7986,41 +7985,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.i1` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.i1` opcode:
+
+-
+
]]>
@@ -8064,41 +8063,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.i2` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.i2` opcode:
+
+-
+
]]>
@@ -8142,41 +8141,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.i4` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.i4` opcode:
+
+-
+
]]>
@@ -8220,41 +8219,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.i8` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.i8` opcode:
+
+-
+
]]>
@@ -8298,41 +8297,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as type (float).
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.r4` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.r4` opcode:
+
+-
+
]]>
@@ -8376,41 +8375,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as type (float).
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.r8` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.r8` opcode:
+
+-
+
]]>
@@ -8454,39 +8453,39 @@ The following method overloads
Loads the element containing an object reference at a specified array index onto the top of the evaluation stack as type (object reference).
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.ref` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.ref` opcode:
+
+-
+
]]>
@@ -8530,41 +8529,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.u1` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.u1` opcode:
+
+-
+
]]>
@@ -8608,41 +8607,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.u2` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.u2` opcode:
+
+-
+
]]>
@@ -8686,41 +8685,41 @@ The following method overloads
Loads the element with type at a specified array index onto the top of the evaluation stack as an .
- is thrown if `array` is a null reference.
-
- is thrown if array does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelem.u4` opcode:
-
--
-
+ is thrown if `array` is a null reference.
+
+ is thrown if array does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelem.u4` opcode:
+
+-
+
]]>
@@ -8764,41 +8763,41 @@ The following method overloads
Loads the address of the array element at a specified array index onto the top of the evaluation stack as type (managed pointer).
- |ldelema `class`|Loads the address of the array element at `index` onto the top of the evaluation stack as type `&` (managed pointer).|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference `array` is pushed onto the stack.
-
-2. An index value `index` is pushed onto the stack.
-
-3. `index` and `array` are popped from the stack; the address stored at position `index` in `array` is looked up.
-
-4. The address is pushed onto the stack.
-
- The `ldelema` is used to retrieve the address of an object at a particular index in an array of objects (of type `class`). The `ldelema` instruction loads the address of the value at index `index` (type `native int`) in the zero-based one-dimensional array `array` and places it on the top of the stack. Arrays are objects and hence represented by a value of type `O`. The value must be of type `class` passed with the instruction.
-
- The return value for `ldelema` is a managed pointer (type `&`).
-
- Note that integer values of less than 4 bytes are extended to `int32` (not `native int`) when they are loaded onto the evaluation stack.
-
- is thrown if `array` is a null reference.
-
- is thrown if `array` does not hold elements of the required type.
-
- is thrown if `index` is negative, or larger than the bound of `array`.
-
- The following method overload can use the `ldelema` opcode:
-
--
-
+ |ldelema `class`|Loads the address of the array element at `index` onto the top of the evaluation stack as type `&` (managed pointer).|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference `array` is pushed onto the stack.
+
+2. An index value `index` is pushed onto the stack.
+
+3. `index` and `array` are popped from the stack; the address stored at position `index` in `array` is looked up.
+
+4. The address is pushed onto the stack.
+
+ The `ldelema` is used to retrieve the address of an object at a particular index in an array of objects (of type `class`). The `ldelema` instruction loads the address of the value at index `index` (type `native int`) in the zero-based one-dimensional array `array` and places it on the top of the stack. Arrays are objects and hence represented by a value of type `O`. The value must be of type `class` passed with the instruction.
+
+ The return value for `ldelema` is a managed pointer (type `&`).
+
+ Note that integer values of less than 4 bytes are extended to `int32` (not `native int`) when they are loaded onto the evaluation stack.
+
+ is thrown if `array` is a null reference.
+
+ is thrown if `array` does not hold elements of the required type.
+
+ is thrown if `index` is negative, or larger than the bound of `array`.
+
+ The following method overload can use the `ldelema` opcode:
+
+-
+
]]>
@@ -8842,35 +8841,35 @@ The following method overloads
Finds the value of a field in the object whose reference is currently on the evaluation stack.
- |ldfld `field`|Pushes the value of a field in a specified object onto the stack.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference (or pointer) is pushed onto the stack.
-
-2. The object reference (or pointer) is popped from the stack; the value of the specified field in the object is found.
-
-3. The value stored in the field is pushed onto the stack.
-
- The `ldfld` instruction pushes the value of a field located in an object onto the stack. The object must be on the stack as an object reference (type `O`), a managed pointer (type `&`), an unmanaged pointer (type `native int`), a transient pointer (type `*`), or an instance of a value type. The use of an unmanaged pointer is not permitted in verifiable code. The object's field is specified by a metadata token that must refer to a field member. The return type is the same as the one associated with the field. The field may be either an instance field (in which case the object must not be a null reference) or a static field.
-
- The `ldfld` instruction can be preceded by either or both of the and prefixes.
-
- is thrown if the object is null and the field is not static.
-
- is thrown if the specified field is not found in the metadata. This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at run time.
-
- The following method overload can use the `ldfld` opcode:
-
--
-
+ |ldfld `field`|Pushes the value of a field in a specified object onto the stack.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference (or pointer) is pushed onto the stack.
+
+2. The object reference (or pointer) is popped from the stack; the value of the specified field in the object is found.
+
+3. The value stored in the field is pushed onto the stack.
+
+ The `ldfld` instruction pushes the value of a field located in an object onto the stack. The object must be on the stack as an object reference (type `O`), a managed pointer (type `&`), an unmanaged pointer (type `native int`), a transient pointer (type `*`), or an instance of a value type. The use of an unmanaged pointer is not permitted in verifiable code. The object's field is specified by a metadata token that must refer to a field member. The return type is the same as the one associated with the field. The field may be either an instance field (in which case the object must not be a null reference) or a static field.
+
+ The `ldfld` instruction can be preceded by either or both of the and prefixes.
+
+ is thrown if the object is null and the field is not static.
+
+ is thrown if the specified field is not found in the metadata. This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at run time.
+
+ The following method overload can use the `ldfld` opcode:
+
+-
+
]]>
@@ -8914,39 +8913,39 @@ The following method overloads
Finds the address of a field in the object whose reference is currently on the evaluation stack.
- |ldflda `field`|Pushes the address of `field` in a specified object onto the stack.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. An object reference (or pointer) is pushed onto the stack.
-
-2. The object reference (or pointer) is popped from the stack; the address of the specified field in the object is found.
-
-3. The address of the specified field is pushed onto the stack.
-
- The `ldflda` instruction pushes the address of a field located in an object onto the stack. The object must be on the stack as an object reference (type `O`), a managed pointer (type `&`), an unmanaged pointer (type `native int`), a transient pointer (type `*`), or an instance of a value type. The use of an unmanaged pointer is not permitted in verifiable code. The object's field is specified by a metadata token that must refer to a field member.
-
- The value returned by `ldflda` is a managed pointer (type `&`) unless the object is pushed onto the stack as an unmanaged pointer, in which case the return address is also an unmanaged pointer (type `native int`).
-
- The `ldflda` instruction can be preceded by either or both of the and prefixes.
-
- is thrown if the object is not within the application domain from which it is being accessed. The address of a field that is not inside the accessing application domain cannot be loaded.
-
- is thrown if the object is null and the field is not static.
-
- is thrown if the specified field is not found in the metadata. This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at run time.
-
- The following method overload can use the `ldflda` opcode:
-
--
-
+ |ldflda `field`|Pushes the address of `field` in a specified object onto the stack.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. An object reference (or pointer) is pushed onto the stack.
+
+2. The object reference (or pointer) is popped from the stack; the address of the specified field in the object is found.
+
+3. The address of the specified field is pushed onto the stack.
+
+ The `ldflda` instruction pushes the address of a field located in an object onto the stack. The object must be on the stack as an object reference (type `O`), a managed pointer (type `&`), an unmanaged pointer (type `native int`), a transient pointer (type `*`), or an instance of a value type. The use of an unmanaged pointer is not permitted in verifiable code. The object's field is specified by a metadata token that must refer to a field member.
+
+ The value returned by `ldflda` is a managed pointer (type `&`) unless the object is pushed onto the stack as an unmanaged pointer, in which case the return address is also an unmanaged pointer (type `native int`).
+
+ The `ldflda` instruction can be preceded by either or both of the and prefixes.
+
+ is thrown if the object is not within the application domain from which it is being accessed. The address of a field that is not inside the accessing application domain cannot be loaded.
+
+ is thrown if the object is null and the field is not static.
+
+ is thrown if the specified field is not found in the metadata. This is typically checked when Microsoft Intermediate Language (MSIL) instructions are converted to native code, not at run time.
+
+ The following method overload can use the `ldflda` opcode:
+
+-
+
]]>
@@ -8990,27 +8989,27 @@ The following method overloads
Pushes an unmanaged pointer (type ) to the native code implementing a specific method onto the evaluation stack.
- |ldftn `method`|Pushes a pointer to a method referenced by `method` on the stack.|
-
- The stack transitional behavior, in sequential order, is:
-
-1. The unmanaged pointer to a specific method is pushed onto the stack.
-
- The specific method (`method`) can be called using the instruction if it references a managed method (or a stub that transitions from managed to unmanaged code).
-
- The value returned points to native code using the CLR calling convention. This method pointer should not be passed to unmanaged native code as a callback routine.
-
- The following method overload can use the `ldftn` opcode:
-
--
-
+ |ldftn `method`|Pushes a pointer to a method referenced by `method` on the stack.|
+
+ The stack transitional behavior, in sequential order, is:
+
+1. The unmanaged pointer to a specific method is pushed onto the stack.
+
+ The specific method (`method`) can be called using the instruction if it references a managed method (or a stub that transitions from managed to unmanaged code).
+
+ The value returned points to native code using the CLR calling convention. This method pointer should not be passed to unmanaged native code as a callback routine.
+
+ The following method overload can use the `ldftn` opcode:
+
+-
+
]]>
@@ -9054,39 +9053,39 @@ The following method overloads
Loads a value of type as a onto the evaluation stack indirectly.
- instruction that specifies the corresponding built-in value class.
-
- Note that integer values of less than 4 bytes are extended to `int32` (not `native int`) when they are loaded onto the evaluation stack. Floating-point values are converted to `F` type when loaded onto the evaluation stack.
-
- Correctly-formed Microsoft Intermediate Language (MSIL) ensures that the `ldind` instructions are used in a manner consistent with the type of the pointer.
-
- The address initially pushed onto the stack must be aligned to the natural size of objects on the machine or a can occur (see the prefix instruction for preventative measures). The results of all MSIL instructions that return addresses (for example, and ) are safely aligned. For datatypes larger than 1 byte, the byte ordering is dependent on the target CPU. Code that depends on byte ordering might not run on all platforms.
-
- can be thrown if an invalid address is detected.
-
- The following method overload can use the `ldind.i` opcode:
-
--
-
+ instruction that specifies the corresponding built-in value class.
+
+ Note that integer values of less than 4 bytes are extended to `int32` (not `native int`) when they are loaded onto the evaluation stack. Floating-point values are converted to `F` type when loaded onto the evaluation stack.
+
+ Correctly-formed Microsoft Intermediate Language (MSIL) ensures that the `ldind` instructions are used in a manner consistent with the type of the pointer.
+
+ The address initially pushed onto the stack must be aligned to the natural size of objects on the machine or a can occur (see the prefix instruction for preventative measures). The results of all MSIL instructions that return addresses (for example, and ) are safely aligned. For datatypes larger than 1 byte, the byte ordering is dependent on the target CPU. Code that depends on byte ordering might not run on all platforms.
+
+ can be thrown if an invalid address is detected.
+
+ The following