How will you convert this C# code into VC++?
-
//Code private static void AddExtension(ReportViewer viewer, string name, Type extensionType) { const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; FieldInfo previewService = viewer.LocalReport.GetType().GetField("m_previewService", Flags); MethodInfo ListRenderingExtensions = previewService.FieldType.GetMethod("ListRenderingExtensions", Flags); IList extensions = ListRenderingExtensions.Invoke( previewService.GetValue(viewer.LocalReport), null) as IList; Type localRenderingExtensionInfoType = Type.GetType( "Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); ConstructorInfo ctor = localRenderingExtensionInfoType.GetConstructor( Flags, null, new Type[] { typeof(string), typeof(string), typeof(bool), typeof(Type), typeof(bool) }, null); object instance = ctor.Invoke(new object[] { name, name, true, extensionType, true }); extensions.Add(instance); } //End Of Code
-
//Code private static void AddExtension(ReportViewer viewer, string name, Type extensionType) { const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; FieldInfo previewService = viewer.LocalReport.GetType().GetField("m_previewService", Flags); MethodInfo ListRenderingExtensions = previewService.FieldType.GetMethod("ListRenderingExtensions", Flags); IList extensions = ListRenderingExtensions.Invoke( previewService.GetValue(viewer.LocalReport), null) as IList; Type localRenderingExtensionInfoType = Type.GetType( "Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); ConstructorInfo ctor = localRenderingExtensionInfoType.GetConstructor( Flags, null, new Type[] { typeof(string), typeof(string), typeof(bool), typeof(Type), typeof(bool) }, null); object instance = ctor.Invoke(new object[] { name, name, true, extensionType, true }); extensions.Add(instance); } //End Of Code
Please don't convert it: let this bad code remain in the
C#
world. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
//Code private static void AddExtension(ReportViewer viewer, string name, Type extensionType) { const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; FieldInfo previewService = viewer.LocalReport.GetType().GetField("m_previewService", Flags); MethodInfo ListRenderingExtensions = previewService.FieldType.GetMethod("ListRenderingExtensions", Flags); IList extensions = ListRenderingExtensions.Invoke( previewService.GetValue(viewer.LocalReport), null) as IList; Type localRenderingExtensionInfoType = Type.GetType( "Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); ConstructorInfo ctor = localRenderingExtensionInfoType.GetConstructor( Flags, null, new Type[] { typeof(string), typeof(string), typeof(bool), typeof(Type), typeof(bool) }, null); object instance = ctor.Invoke(new object[] { name, name, true, extensionType, true }); extensions.Add(instance); } //End Of Code
Can you explain about your request? I think we can help you and its better than convert this code to c++.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Please don't convert it: let this bad code remain in the
C#
world. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Please don't convert it: let this bad code remain in the
C#
world. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]You're lucky you didnt say it on the C# world. :-D ;)
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
You're lucky you didnt say it on the C# world. :-D ;)
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
There I would say the opposite... :rolleyes: :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
//Code private static void AddExtension(ReportViewer viewer, string name, Type extensionType) { const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; FieldInfo previewService = viewer.LocalReport.GetType().GetField("m_previewService", Flags); MethodInfo ListRenderingExtensions = previewService.FieldType.GetMethod("ListRenderingExtensions", Flags); IList extensions = ListRenderingExtensions.Invoke( previewService.GetValue(viewer.LocalReport), null) as IList; Type localRenderingExtensionInfoType = Type.GetType( "Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); ConstructorInfo ctor = localRenderingExtensionInfoType.GetConstructor( Flags, null, new Type[] { typeof(string), typeof(string), typeof(bool), typeof(Type), typeof(bool) }, null); object instance = ctor.Invoke(new object[] { name, name, true, extensionType, true }); extensions.Add(instance); } //End Of Code
C++/CLI:
private:
static void AddExtension(ReportViewer ^viewer, System::String ^name, Type ^extensionType)
{
const BindingFlags Flags = BindingFlags::NonPublic | BindingFlags::Public | BindingFlags::Instance;
FieldInfo ^previewService = viewer->LocalReport->GetType()->GetField("m_previewService", Flags);
MethodInfo ^ListRenderingExtensions = previewService->FieldType->GetMethod("ListRenderingExtensions", Flags);
IList ^extensions = dynamic_cast(ListRenderingExtensions->Invoke(previewService->GetValue(viewer->LocalReport), nullptr));
Type ^localRenderingExtensionInfoType = Type->GetType("Microsoft.Reporting.LocalRenderingExtensionInfo, " + "Microsoft.ReportViewer.Common," + "Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
ConstructorInfo ^ctor = localRenderingExtensionInfoType->GetConstructor(Flags, nullptr, gcnew array { System::String::typeid, System::String::typeid, bool::typeid, Type::typeid, bool::typeid }, nullptr);
System::Object ^instance = ctor->Invoke(gcnew array { name, name, true, extensionType, true });
extensions->Add(instance);
}David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB & C# to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++
-
There I would say the opposite... :rolleyes: :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Consider Politics as a career? :-D
«_Superman_»
-
Consider Politics as a career? :-D
«_Superman_»
Nope, unfortunatey in my Country there are clowns (e.g. Mr. Berlusconi) far better than me. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]