+ 2
How can I use explicit conversion in C# as I m trying this for converting int to char...
4 Réponses
+ 2
I don't know much about c# but i guess there is no problem in type-conversion.
You are trying to use Implicitly typed as Explicitly types
variables which are declare using the var keyword should have compile-time initialization in c#. What m trying to say is declaration and initialization should be in same statement.
eg 1)//this is wrong
var i;
for(i = 1 ; i<=5 ; i++)
{
//do something
}
eg 2)//this is correct
for(var i = 1 ; i<=5 ; i++)
{
//do something
}
Secondly you don't need to typecast to int as the compiler is smart enough to figure-out what type of value is getting stored
//consider the following code snippet
for(var i=65;i<=70;i++)
{
Console.Write((char)i);
}
output: ABCDEF
+ 2
Updated Rishi Anand ..
See code in multi-line comment..
+ 2
It's working....
THANK YOU! Rishi Anand 😊
0
Please post your code here