According to the documentation, the int (Int32) type inherits the
Iconvertible interface. This interface has a bunch of methods such as
ToDecimal, ToDouble etc. The thing is that I don't seem to be able to see
any of this methods, even if I make a direct cast in the int. What am I
missing?
Thanks. 4 3578
true. VS doesnt display all these methods in intellisense.
you can use explicit interface implementation by casting IConvertible
iconvertInt = (IConvertible)Y ourInt.
and then use methods.
this is because, these types are most frequently used and i guess VS team
considered not to display a deluge of methods in intellisense.
The best way to use is Convert class.
Av. http://dotnetjunkies.com/WebLog/avnrao http://www28.brinkster.com/avdotnet
"Rene" <no****@nospam. nospam> wrote in message
news:Oz******** ******@TK2MSFTN GP12.phx.gbl... According to the documentation, the int (Int32) type inherits the Iconvertible interface. This interface has a bunch of methods such as ToDecimal, ToDouble etc. The thing is that I don't seem to be able to see any of this methods, even if I make a direct cast in the int. What am I missing? Thanks.
I don't get it, before I posted this I tryied doing this:
int someInt = 0;
IConvertible interfaceRef = (IConvertible)s omeInt;
Then I used the "interfaceR ef " variable to get a hold of the methods on the
IConvertible interface but I only saw the same thing as if I was using the
"someInt" variable. If it works on your computer then something must be
wrong with my intellisense. Maybe a good reboot will fix the problem.
Thanks.
"avnrao" <av*@newsgroups .com> wrote in message
news:uO******** ******@TK2MSFTN GP15.phx.gbl... true. VS doesnt display all these methods in intellisense. you can use explicit interface implementation by casting IConvertible iconvertInt = (IConvertible)Y ourInt. and then use methods.
this is because, these types are most frequently used and i guess VS team considered not to display a deluge of methods in intellisense. The best way to use is Convert class.
Av. http://dotnetjunkies.com/WebLog/avnrao http://www28.brinkster.com/avdotnet
"Rene" <no****@nospam. nospam> wrote in message news:Oz******** ******@TK2MSFTN GP12.phx.gbl... According to the documentation, the int (Int32) type inherits the Iconvertible interface. This interface has a bunch of methods such as ToDecimal, ToDouble etc. The thing is that I don't seem to be able to see any of this methods, even if I make a direct cast in the int. What am I missing? Thanks.
1) If you cast to Icomparable this should work,
2) The reason that you can't see these methods is because there is an
explicit interfact reference,
this is slightly different, have a look at this quick sample
interface I_Foo
{
void Bar();
}
public class Foo : I_Foo
{
#region I_Foo Members
public void Bar()
{
MessageBox.Show ("hello");
}
#endregion
}
public class Foo2 : I_Foo
{
#region I_Foo Members
void I_Foo.Bar()
{
MessageBox.Show ("I_Foo.Bar" );
}
#endregion
}
"Rene" wrote: I don't get it, before I posted this I tryied doing this:
int someInt = 0; IConvertible interfaceRef = (IConvertible)s omeInt;
Then I used the "interfaceR ef " variable to get a hold of the methods on the IConvertible interface but I only saw the same thing as if I was using the "someInt" variable. If it works on your computer then something must be wrong with my intellisense. Maybe a good reboot will fix the problem.
Thanks.
"avnrao" <av*@newsgroups .com> wrote in message news:uO******** ******@TK2MSFTN GP15.phx.gbl... true. VS doesnt display all these methods in intellisense. you can use explicit interface implementation by casting IConvertible iconvertInt = (IConvertible)Y ourInt. and then use methods.
this is because, these types are most frequently used and i guess VS team considered not to display a deluge of methods in intellisense. The best way to use is Convert class.
Av. http://dotnetjunkies.com/WebLog/avnrao http://www28.brinkster.com/avdotnet
"Rene" <no****@nospam. nospam> wrote in message news:Oz******** ******@TK2MSFTN GP12.phx.gbl... According to the documentation, the int (Int32) type inherits the Iconvertible interface. This interface has a bunch of methods such as ToDecimal, ToDouble etc. The thing is that I don't seem to be able to see any of this methods, even if I make a direct cast in the int. What am I missing? Thanks.
"avnrao" wrote: true. VS doesnt display all these methods in intellisense. you can use explicit interface implementation by casting IConvertible iconvertInt = (IConvertible)Y ourInt. and then use methods.
this is because, these types are most frequently used and i guess VS team considered not to display a deluge of methods in intellisense. The best way to use is Convert class.
it's not an issue of intellisense not displaying it. when a method of the
interface is explicitly implemented, it's simply not available through the
type. that's a C# language feature, not a VS display feature.
Av. http://dotnetjunkies.com/WebLog/avnrao http://www28.brinkster.com/avdotnet
"Rene" <no****@nospam. nospam> wrote in message news:Oz******** ******@TK2MSFTN GP12.phx.gbl... According to the documentation, the int (Int32) type inherits the Iconvertible interface. This interface has a bunch of methods such as ToDecimal, ToDouble etc. The thing is that I don't seem to be able to see any of this methods, even if I make a direct cast in the int. What am I missing? Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bill Cart |
last post by:
This is a question from a confused newbe.I have an oldDbCommand component
called oleDbCmdAddDemoReq and an oldDbConnection called oleDbConDemoReq on a
web form. I have the following code:
oleDbConDemoReq.Open();
oleDbCmdAddDemoReq.ExecuteNonQuery();
oleDbConDemoReq.Close();
I get this error message:
|
by: sjoshi |
last post by:
Hello All
I have schema as such:
<xs:element name="OFDateProxies">
<xs:complexType>
<xs:sequence>
<xs:element name="M_CRProxy_OID" msdata:DataType="System.Guid,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
type="xs:string" />
|
by: Leon Shaw |
last post by:
I'm trying to insert a record into a sql server 2000 database using a store
procedure (vs.net is my develop tool) on the button click event but I keep
getting the following error after clicking the button:
Object must implement IConvertible.
What Can I do to fix this problem. It seems like it want to explicit convert
a value to a specific datatype, but I set my command through vs.net which
took care of that for me. what would you suggest?
|
by: Tim::.. |
last post by:
Hi can someone please help me with the following error!
I keep getting:
ERROR:
System.InvalidCastException: Object must implement IConvertible.
Line 231: PageID = cmd.Parameters("@PageID").Value
Line 232:
Line 233: Dim myReader As SqlDataReader = cmd.ExecuteReader()
|
by: charleswesley |
last post by:
I think the problem is with the strPrice variable in the AddToCart()
sub. I've been messing with it all morning and can't seem to figure it
out. Any ideas?
+++++++++++++++++++++++++++++++++++++++++++
+ EXCEPTION +
+++++++++++++++++++++++++++++++++++++++++++
Object must implement IConvertible.
Description: An unhandled exception occurred during the execution of
| |
by: dan |
last post by:
I am using VB.NET 2003 and SQL Server 2000.
My program inserts new rows in a SQL table based on data read from a file.
I generated the commands and the stored procedures with the DataAdapter
wizard.
The execution of the Insert Command throws the exception: "Object must
implement IConvertible. "
1. What object does it refer to? The Command itself?
2. On the other hand, in the VS Help file all IConvertible members have this
warning:...
|
by: dan |
last post by:
I am using VB.NET 2003 and SQL Server 2000.
My program inserts new rows in a SQL table based on data read from a file.
I generated the commands and the stored procedures with the DataAdapter
wizard.
The execution of the Insert Command throws the exception: "Object must
implement IConvertible. "
1. What object does it refer to? The Command itself?
2. On the other hand, in the VS Help file all IConvertible members have this
warning:...
|
by: Bruce A. Julseth |
last post by:
I am getting an error message on .ExecuteNonQuery using a procedure stating
the I need to use IConvertible. The data the gives the error is a defined as
"SqlDbType.Money."
When I search Microsoft and find an explantion of IConvertible, nothing is
mentioned for "Money."
Can someone provide me to a coding example where the data is "Text" coming
from the from and data going to the database is "Money?"
|
by: lcorrias |
last post by:
i try to do a simple insert using SQLDataSource and a Stored Procedure
I try all night and always have this error
Object Must Implement IConvertible
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |