|
Thank you and Nick,
So about the security issue mentioned in your tutorial, do we have a reasonable solution yet?
Great tutorial, it helps a lot.
Thanks again.
|
|
|
|
|
Could you please be a little more specific? There's lots of security "issues" (not holes or anything, but things you must understand).
You might want to take a look at Understanding .NET Code Access Security[^] for a good overview of CAS and follow the links to MSDN for more detail.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I wanted to use a .mov file in my splash screen. Can anyone give me some pointers? Are any other video file formats easier to use?
|
|
|
|
|
You can use DirectX to include both audio and video playback. Read this[^] for more information. The only caveat is I am not aware that it will/won't play a .mov file.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
I was wondering what the pros and cons of using convert vs parse, as in
<br />
string s = "2";<br />
<br />
Convert.ToInt32(s);<br />
<br />
int.Parse(s);<br />
|
|
|
|
|
Probably the best way to anser that question is by writing a quick program.
Capture the time, do 1000 Convert.ToInt32();, capture the time,
do 1000 int.Parse(), capture the time. Then see if there is a difference worth noting.
This signature left intentionally blank
|
|
|
|
|
Hi!
I don´t know the exactly function of both methods, but there is one big difference.
I can´t explain it in words, just try following code:
using System;
using System.Globalization;
namespace DummyTest
{
///
/// Summary description for Class2.
///
public class Class2
{
[STAThread]
static void Main()
{
string test = "2,5";
try
{
double i = Convert.ToDouble(test);
Console.WriteLine(i);
double a = double.Parse(test, NumberStyles.Float);
Console.WriteLine(a);
}
catch (Exception err)
{
Console.WriteLine("Exception: ", err.Message);
}
}
Console.Readline();
}
}
So you can see, the Convert method try to convert equal what he gets, and with the parse method you are able to specify the input format.
Certainly there are more pro´s and con´s but I only know this one...
Norman-Timo
|
|
|
|
|
I saw an episode of MSDN TV[^] recently with Anders Hejlsberg in which he said there is no real difference between the two. The Convert class is just meant to be a "one-stop shop" for conversions between all the primitive types, but there's no real advantage or disadvantage over calling the Parse or ToString methods of individual types.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Mark Nischalke wrote:
I was wondering what the pros and cons of using convert vs parse, as in
Internally, the Convert.ToInt32 simply calls int.Parse , but checks for null values before the call. Convert.ToInt32 calls a specific overloaded method of Parse that passes a null value for the IFormatProvider parameter of another overloaded version of the Parse method. Given this, you can see that Parse provides extended functionality allowing the developer to specify their own IFormatProvider if they choose. In the end it all depends on what you are trying to do, and what functionality you want to get out of it.
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Hi folks,
OK, what I'm interested in are the technical pros and cons of data initialisation in a classes.
I.e. which is better?
class Test<br />
{<br />
private int mInt = -1;<br />
Test()<br />
{<br />
}<br />
}
or
class Test<br />
{<br />
private int mInt;<br />
Test()<br />
{<br />
mInt = -1;<br />
}<br />
}
The reason I ask is that I usually have several constructors on my classes and I prefer the first method so I can guarantee that whichever constructor I'm entering, all the fields are initialised the same way.
But are there technical reasons not to do this?
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
I think that the first method is much better too, because it is possible that you have problems to initialize the variable at a later time.
(perhaps in a try-catch chapter -> than you are not able to use the new instanced variable out of this chapter)
With the first method a variable is certainly instanced which is easier to handle.
So it´s also easier and safer to check if a variable is set to an invalid value than to check if this variable is instanced.
So if I´m wrong please rectify me...
Norman-Timo
|
|
|
|
|
I don't believe there is any technical reason to prefer the second method (Unless you're a VB programmer;P). As you point out the first method gaurantees the variable will be initialed to a useful value no matter which constructor you use.
|
|
|
|
|
|
|
It compiles down to the same thing. If you don't declare a default constructor, one is defined for you anyway and instance fields are initialized in it.
The only difference is that instance fields initialized outside the default constructor - when compiled - are initialized before base.ctor() is called. Any fields you initialize explicitly in your default constructor are initialized after the call to base.ctor() (compiled into your default constructor automatically).
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thanks for the replies, it has put my mind at rest
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
Hi All,
I hava developed a Addin which has a Custom toolbar. and also have a VBA Application embeded in the same Excel Object. in this scenario my custom toolbar flickers continusly.
Any please help me.....
Adv Thnaks
Praveen Kumar Kella
|
|
|
|
|
Hi All,
I had some problem with Information Bridge Framework. The problem is I have developed a COM Addin for Office Excel 2003. this addin working fine until unless I install Information Bridge Framework in my system. It is giving some strange error while loading the Addin in to Excel.
Eror Details:
1) Exception Information
*********************************************
Exception Type: System.InvalidOperationException
Message: There is an error in the XML document.
TargetSite: System.Object Deserialize(System.Xml.XmlReader, System.String)
HelpLink: NULL
Source: System.Xml
StackTrace Information
*********************************************
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at MS.IT.ReportingServices.Addin.AddinConfiguration.Init()
at MS.IT.ReportingServices.Addin.AddinConfiguration.get_Instance()
at MS.IT.ReportingServices.Addin.Connect.OnConnection(Object application, ext_ConnectMode connectMode, Object addInInst, Array& custom)
Some one help me on the same
Adv Thnaks
Praveen Kumar Kella
|
|
|
|
|
|
Hi. How can I show a message when I get an exception in a web service? In other apps I use the Message property of the exception object, but with the web service I don't know how to do that.
How do you show exception information if the error comes from a web service?
Regards,
Diego F.
|
|
|
|
|
Since the nature of the Web Service is like a 'server' process which runs in the background and caters users requests silently, it is best suited to
a. Log the error in local text/xml files, windows event log which can be monitored by the IIS Admin
b. If a particular WebMethod gives errors/exceptions you should inform the user about the failure using some <errorcode> tag being set in the returned xml.
|
|
|
|
|
If you are invoking the web Service with C++ Code like
pWSClient = new COleDispatchDriverWrapper;
if(pWSClient->CreateDispatch("MSSOAP.SoapClient30"))
pWSClient->mssoapinit((LPCTSTR)pWebServiceParams->csWebServiceLink, (LPCTSTR)pWebServiceParams->csServiceName, (LPCTSTR)pWebServiceParams->csServicePort, NULL);
You can catch exception such as (in the given order)
catch(COleException *eCOleException)
catch(COleDispatchException *eCOleDispatchException)
catch(CException *eCException)
catch(_com_error &ecom_error)
catch(...)
|
|
|
|
|