We've started converting some applications to the .NET 2.0 framework. When
compiling in VS 2005, I'm getting a warning on this line:
return (unitWidth != null ) ? unitWidth : new Unit("0px");
Looks valid to me, but this gives a warning with "new" underlined saying
"warning CS0429: Unreachable expression code detected". 3 3301
Hi,
It looks valid indeed.
I just wrote this in a project:
string G( string q)
{
return (q != null) ? q : new string('r', 12);
}
and it did compiled without warning.
Can you post the complete method?
"Don Burden" <no****@nomail. comwrote in message
news:ua******** ******@TK2MSFTN GP04.phx.gbl...
We've started converting some applications to the .NET 2.0 framework.
When compiling in VS 2005, I'm getting a warning on this line:
return (unitWidth != null ) ? unitWidth : new Unit("0px");
Looks valid to me, but this gives a warning with "new" underlined saying
"warning CS0429: Unreachable expression code detected".
"Don Burden" <no****@nomail. coma écrit dans le message de news: ua************* *@TK2MSFTNGP04. phx.gbl...
| We've started converting some applications to the .NET 2.0 framework.
When
| compiling in VS 2005, I'm getting a warning on this line:
| return (unitWidth != null ) ? unitWidth : new Unit("0px");
|
| Looks valid to me, but this gives a warning with "new" underlined saying
| "warning CS0429: Unreachable expression code detected".
My guess is that your code above this line will never allow unitWidth to be
null.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
Hi,
Not even that, I changed my method to :
string G( )
{
string q = "sfsdf";
return (q != null) ? q : new string('r', 12);
}
and I still do not get a warning
There must be another error somewhere
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Joanna Carter [TeamB]" <jo****@not.for .spamwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
"Don Burden" <no****@nomail. coma écrit dans le message de news: ua************* *@TK2MSFTNGP04. phx.gbl...
| We've started converting some applications to the .NET 2.0 framework.
When
| compiling in VS 2005, I'm getting a warning on this line:
| return (unitWidth != null ) ? unitWidth : new Unit("0px");
|
| Looks valid to me, but this gives a warning with "new" underlined saying
| "warning CS0429: Unreachable expression code detected".
My guess is that your code above this line will never allow unitWidth to
be
null.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve Jorgensen |
last post by:
Microsoft acknowledges a bug with this, but the bug is worse than they say.
It turns out that if you use the Like operator without a wildcard on a
snapshot type recordset, all sorts of wierd, undesirable things can happen.
This situation can arise when you need something like a list of match
conditions, some of which are exact matches.
According to Microsoft, the bug is that it will treat all expressions without
wildcards as if they...
|
by: Filip Strugar |
last post by:
...or where should I post it if this is not the right place?
Goes like this: I've got a following method in a class DataSource:
public IHeightmapSampler GetSampler(ushort maxSmpX, ushort maxSmpY)
|
by: Jerry |
last post by:
I managed to narrow this down to a very simple expression. try this:
private void Bug()
{
bool b = false;
Test(3, (b || b) && b && !b);
}
private void Works()
{
|
by: J.D. Herron via .NET 247 |
last post by:
Just wanted to throw out there a VC7.1 compiler bug when usingwarning level 4. The following code will demonstrate theproblem:
class TestClass
{
public:
// Initialized float member, generates C4702 warning
TestClass() : m_fValue(1.f)
{
try
|
by: dfetrow410 |
last post by:
Can I do this in an if statement?
public string getClass()
{
counta = counta + 1;
if (counta < 2 )
{
| |
by: teddysnips |
last post by:
I'm new to C# - recent background mainly ASP.NET with VB.NET.
Anyhoot, I needed to create a C# statement analogous to VB's IIf:
VB.NET
Dim e As Boolean
e = IIf((CInt(MyVariable) 0), True, False)
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42)
Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86)
RFE : 262 open ( +4) / 291 closed ( +4) / 553 total ( +8)
New / Reopened Patches
______________________
|
by: cie |
last post by:
Hi, anyone please help me
when I try to close a connection to the database from a static method, "Unreachable code detected" error occured.
What's the problem actually?
Thank you before
|
by: ITC |
last post by:
When i write web method in C#.
I got a warning and can't get the right result though it run.
Code is below.
public string CurrencyConverter(double amt, string fromCurrency, string toCurrency)
{
string currencyLabel ={ "USD", "AUD", "PDS", "MYR", "SGD" };
|
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: 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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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...
| | |