hi guys,
someone know if exists a function that convert a object from any type to
other type?
exaple:
ConvertFromTO(o bject obj, System.Type typeSrc, System.Type typeDst); 3 1705
Javier Ros <jros@NO$PAMHER Eemuasa.es> wrote: someone know if exists a function that convert a object from any type to other type?
exaple: ConvertFromTO(o bject obj, System.Type typeSrc, System.Type typeDst);
What would you expect it to do if presented with, say, Random and
XmlDocument? Or WebRequest and Int32? Most conversions just don't make
sense. If they make sense, they should be supported by one or other of
the types (possibly using IConvertible).
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
And if they do make sense but don't exist, you can usually create a derived
class with an implicit or exlpicit conversion and implement the change
yourself.
"Jon Skeet" <sk***@pobox.co m> wrote in message
news:MP******** *************** @news.microsoft .com... Javier Ros <jros@NO$PAMHER Eemuasa.es> wrote: someone know if exists a function that convert a object from any type
to other type?
exaple: ConvertFromTO(o bject obj, System.Type typeSrc, System.Type typeDst);
What would you expect it to do if presented with, say, Random and XmlDocument? Or WebRequest and Int32? Most conversions just don't make sense. If they make sense, they should be supported by one or other of the types (possibly using IConvertible).
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet/ If replying to the group, please do not mail me too
"Javier Ros" <jros@NO$PAMHER Eemuasa.es> wrote in message
news:e8******** ******@tk2msftn gp13.phx.gbl... hi guys,
someone know if exists a function that convert a object from any type to other type?
exaple: ConvertFromTO(o bject obj, System.Type typeSrc, System.Type typeDst);
Check ChangeType method of Convert class.
HTH,
Maciej This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Philip Mette |
last post by:
I am in a crunch and need to covert this Oracle statement to MSSQL. Is
there any Oracle/MSSQL experts out there that can help me? I do not
understand the syntax enough to modify this.
Thanks so much for any assistance. Here is the procedure.
CREATE PROCEDURE UPD_ACTIVITY IS
CURSOR ACT_cur1
IS
SELECT DISTINCT A.ACCT_NUM, A.DUE_DATE
|
by: Cindy Liu |
last post by:
Hi Everyone,
In .Net we have XmlSerializer to convert c# class to xml, or vice versa. Do
we have any APIs to convert c# class to XSD?
Thanks in advance,
Cindy
|
by: Ray Z |
last post by:
So far, I get the idea that if I want to use both the unmanaged and managed
memory, I can not avoid memory copy. But I DO need to avoid it. I get a idea
that maybe I could use "union" to convert byte to int and so on. Here is
my source code, I wonder if this will work with GC?
struct MyUnion
{
|
by: ad |
last post by:
I use a fileUpload of ASP.NET to read a csv file from client into a Strem
like:
Stream myStream = FileUpload1.FileContent;
But the file from Client if of CharSet BIG5.
How can I covert it to UTF8?
|
by: Calros Lo |
last post by:
Dear all:
I develop a programe that need when I get a string , such as "123" or
"ABC",if I get string "123" and the system will help me to create new
string "124" , if I get string "ABC" and the system will help me to create
new string "ABD" , could somebody can help me how to programe it , thank you
very much.
I don't know to how to covert string as ASCII and add integer value and
covert the integer back to string, hope can support me...
| |
by: Wisdo |
last post by:
Hi All,
char to char ** is compile error. why?
if i hava a string array. yes. it's not safe and it's better to use
vector<stringinstead.
but my point is the language feature.
char sex = {"Male", "Female" };
|
by: Biji |
last post by:
Help to Covert MS Acess Data Base tO SQL Server Database
|
by: cvijaykrishna |
last post by:
hi i already designed a web based application in VS-2005 and i have a problem now that is how to covert it into ajax based wesite i have ajax frame work installed on my system pls sugesst me any way out.
with regards&thanks
vijay
|
by: =?Utf-8?B?dmluY2VudA==?= |
last post by:
Is there any method to covert a pdf file into jpg file in c#?
Many thanks for your replying.
|
by: jonny |
last post by:
Option Explicit
Private mdTarget1 As Date
Private mdTarget2 As Date
' called on form load
Public Sub SetRecordStartTime()
mdTarget1 = DateAdd("n", 60, Time)
mdTarget2 = DateAdd("n", 120, Time)
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |