CSharp equivalent functions
-
1.What is the equivalent settings for option strict on and option explicit on in c# ? 2.I have a class in another project ( VC++). I want to access the methods and properties in VC++ class from my project in C#. The VC++ is a standalone EXE project and hence I cant add any reference to my project. But in VB I found a method named GetObject( "AssemblyName") to retrieve the object in runtime. As VB.Net supports early binding by setting option explicit ON , the methods and properties of the VC++ class can be accessed by creating an instance of system.object. Can anyone please tell me how can we do the same in C#.net ? 3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
-
1.What is the equivalent settings for option strict on and option explicit on in c# ? 2.I have a class in another project ( VC++). I want to access the methods and properties in VC++ class from my project in C#. The VC++ is a standalone EXE project and hence I cant add any reference to my project. But in VB I found a method named GetObject( "AssemblyName") to retrieve the object in runtime. As VB.Net supports early binding by setting option explicit ON , the methods and properties of the VC++ class can be accessed by creating an instance of system.object. Can anyone please tell me how can we do the same in C#.net ? 3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
BINOVAR wrote:
1.What is the equivalent settings for option strict on and option explicit on in c# ?
There isn't one. These constraints are always enforced and cannot be disabled.
BINOVAR wrote:
2.I have a class in another project ( VC++). I want to access the methods and properties in VC++ class from my project in C#. The VC++ is a standalone EXE project and hence I cant add any reference to my project. But in VB I found a method named GetObject( "AssemblyName") to retrieve the object in runtime. As VB.Net supports early binding by setting option explicit ON , the methods and properties of the VC++ class can be accessed by creating an instance of system.object. Can anyone please tell me how can we do the same in C#.net ?
Look into p/invoke; I know you can access native dll's that way, I've never tried abusing an exe like that. Worst case would be writing a VB.net wrapper dll and calling that from C#.
BINOVAR wrote:
3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
No. And you shouldn't be using it in VB either unless you like corrupting your state and data.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
-
1.What is the equivalent settings for option strict on and option explicit on in c# ? 2.I have a class in another project ( VC++). I want to access the methods and properties in VC++ class from my project in C#. The VC++ is a standalone EXE project and hence I cant add any reference to my project. But in VB I found a method named GetObject( "AssemblyName") to retrieve the object in runtime. As VB.Net supports early binding by setting option explicit ON , the methods and properties of the VC++ class can be accessed by creating an instance of system.object. Can anyone please tell me how can we do the same in C#.net ? 3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
BINOVAR wrote:
3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
Someone will slap me for saying this, but you can also nest try catch blocks, and there's no requirement to have code inside the catch portion of the try block. At some point you will be causing the hari kari of whatever dev has to look at the code later though.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
-
BINOVAR wrote:
3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
Someone will slap me for saying this, but you can also nest try catch blocks, and there's no requirement to have code inside the catch portion of the try block. At some point you will be causing the hari kari of whatever dev has to look at the code later though.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
Skymir wrote:
Someone will slap me for saying this
You know already it is a bad thing. You obviously don't need someone to tell you. I've just had my dinner and not feeling energetic enough to slap anyone so, if you don't mind, could you do it yourself.
*Developer Day Scotland - Free community conference Delegate Registration Open
-
1.What is the equivalent settings for option strict on and option explicit on in c# ? 2.I have a class in another project ( VC++). I want to access the methods and properties in VC++ class from my project in C#. The VC++ is a standalone EXE project and hence I cant add any reference to my project. But in VB I found a method named GetObject( "AssemblyName") to retrieve the object in runtime. As VB.Net supports early binding by setting option explicit ON , the methods and properties of the VC++ class can be accessed by creating an instance of system.object. Can anyone please tell me how can we do the same in C#.net ? 3.Is there any C# equivalent function for "ON ERROR RESUME NEXT" in VB ? We can use Try catch but catch block will be excuted if any error occur in try block.
BINOVAR wrote:
We can use Try catch but catch block will be excuted if any error occur in try block.
If I find out you have written a try-catch-ignore block I will reprogram your software with a large and very blunt axe.
*Developer Day Scotland - Free community conference Delegate Registration Open
-
Skymir wrote:
Someone will slap me for saying this
You know already it is a bad thing. You obviously don't need someone to tell you. I've just had my dinner and not feeling energetic enough to slap anyone so, if you don't mind, could you do it yourself.
*Developer Day Scotland - Free community conference Delegate Registration Open