|
Really should be part of VS by now...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
ReSharper is the demon responsible for most of this var nonsense!
var customers = ctx.Customers.Where(c => c.HasOrders);
var customer = customers.FirstOrDefault();
if (customer != null)
{
var orderCount = customer.Orders.Count;
var value = customer.Orders.Sum(o => o.Total);
var postage = ctx.Postage.Where(p => P.Country == customer.Country);
var valuePlusPostage = value += postage;
var tax = financeHelper.TaxRate;
}
|
|
|
|
|
But if you don't like the option that changes a fully-specified type to 'var', why are you using it? I'm assuming here that Resharper doesn't do that by itself, or if it does that it is a 'feature' that can be turned off.
(No, I am not using Resharper myself, never have)
(Yes, I do prefer 'var': it saves keystrokes; intellisense provides me with the name of type if I need it)
|
|
|
|
|
I don't use resharper myself but most of my colleagues do. In its default configuration it flags a warning on any use of explicit types, suggesting you use var instead. Yes it can be turned off, but no-one does. And yes it can also be ignored, but people would rather just use var to get rid of the wiggly line (see previous comment).
|
|
|
|
|
F-ES Sitecore wrote: people would rather just use var They should be made to rewrite their code in COBOL. 
|
|
|
|
|
Ok, I'll bite. But I am not saying this or that, just interested in your opinion.
Why wouldn't you use var ? What's wrong with it?
|
|
|
|
|
You're doing a code review in Crucible and you see this statement:
var descendant = GetDescendant(); What is the type of descendant? Is it nullable? Surely Intellisense will tell me what the type is? Oh wait, I'm in a web browser now.
This space for rent
|
|
|
|
|
I implied we were talking about developers and var , not how it affects reviewers. But fair enough I guess.
If you know what GetDescendant() does, then you'll know the return type (assuming here).
If you don't know what the method does, then maybe that should be made clear first.
What is more important, the method and what it does, or the specific technical return type?
I'm not trying to convince you of anything, I'm just trying to understand your way of thinking.
|
|
|
|
|
maarten_oosterhoff wrote: not how it affects reviewers. But fair enough I guess. Who does your code reviews if it's not developers?maarten_oosterhoff wrote: If you know what GetDescendant() does, then you'll know the return type (assuming here). And what happens when you're reviewing a piece of code that calls a method that was written 5 years ago that you have never had cause to look into? You're introducing blockers for reviewers just because you can't be bothered to type the full type.
maarten_oosterhoff wrote: What is more important, the method and what it does, or the specific technical return type? If you don't know the return type, how can you tell if the person whose code you're reviewing is using the type properly or that it will even compile? You have to give people the context to help them.
This space for rent
|
|
|
|
|
Pretty much what Pete said, you can't discern the types simply by looking at them. Can I find them out? Yes. But I'd rather not have to find them out, I'd rather know by just looking at the code.
|
|
|
|
|
F-ES Sitecore wrote: you can't discern the types simply by looking at them
Agreed, for things like:
var frob = DoSomething();
But, for cases where the type is obvious, var cuts down on the clutter:
var myFoos = new Dictionary<string, Foo>();
However, if for some reason you need the variable type to be an interface or a base type, var isn't a good option:
IDictionary<string, Foo> myFoos = new Dictionary<string, Foo>();
Like almost anything, var has sensible uses and no-so-sensible uses. It's up to the developer to decide which is which!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
var is a Microsoft mechanism that allows VB last-resorters to be okay with using as more appropriate strongly-typed language rather than comply with the actual paradigm of being a real programmer.
In essence, it is the "safe space" of programming constructs and as such, is used only by flaming lib-tards that think all code should be equal in the eyes of the compiler.
THAT is what's wrong with var .
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I think you're flaming 😂😂
|
|
|
|
|
And it's not even picked up some of the obvious things!
var customer = ctx.Customers.FirstOrDefault(c => c.HasOrders);
...
var postage = ctx.Postage.Where(p => P.Country == customer.Country);
...
var valuePlusPostage = value += postage;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
"Browse ith record in the GridView if error rerun faulty records" this is my request, using a while loop 2, while outer ring running again if the ith sample error message, the sample code below if An error occured not run very well, but there are problems caused ith GridView on jump number and apparently does not run again faulty records, when defective block catch (Exception ex) is run, it gets in the error message in the block catch (Exception ex) and i will run continuously variable for every row (or rows) of the GridView, thanks to the help you troubleshoot.
private void Tinh(object sender)
{
DevExpress.XtraGrid.Views.Grid.GridView Gv = (GridView)sender;
<pre>
i = 0;
while (i < Gv.RowCount && bStop)
{
try
{
// While i have not stopped yet, the East and the next run
while (i < Gv.RowCount && bStop)// Running the main loop
{
if (condition)
{
//do somthing
}
else
{
//do somthing
}
i++;
} // Running the main loop
}
catch (Exception ex)
{
i++;
Debug.Print("error: " + ex.Message);
}
}// Repeat loop faulty next record
}
modified 20-Aug-16 4:21am.
|
|
|
|
|
Sorry, but I didn't get any idea of what your problem is from that, or any clue as to what help you need.
Remember, we have no access to your data, so we can't run your code under the same circumstances you do to spot problems.
What does the debugger say is happening when it does something you didn't expect, or doesn't do something you did? What did you do, what data is it working from to cause the problem?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have formatted your code correctly but I am afraid it still makes no sense. Why do you repeat the same while loop inside the outer one?
|
|
|
|
|
because when browsing to records ith if an error message will jump to the next record, if there are errors it will run the loop outside. if no errors it will run the loop in. it did not escape the function catch (Exception ex) when faulty, endless loop.
|
|
|
|
|
HI to all ^^
May I ask if there is a right code for reading a response of port from declaring a command to send via AT commands, which the commands is AT+CREG and read the reponse of this command (AT+CREG)
please help
and thank you very much
|
|
|
|
|
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
As of now, I use a C#.net platform in a GSMComm library format but GSMComm has no method in how to fetch the format for AT+CREG and still i'm still searching to gain more ideas to achieve the pattern and i've stuck about parsing to read the response of AT commands as an output using AT+CREG that possibly result in a format
AT+CREG?
+CREG: 2,1,"02D0","CB9B"
and I need your help to guide me in how to achieve at least this format
any type of methods and properties of C#
thank you very much
|
|
|
|
|
just like to know can we draw uml diagram from visual studio 2013 community edition ?
it is by default not there. so i install Microsoft Visual Studio 2013 SDK - ENU and Microsoft Visual Studio 2013 Visualization and Modeling SDK but still Architecture menu is not coming in my VS2013 community edition IDE.
does it mean that people who use VS 2013 community edition they will not get this features ?
please drive me to right direction. thanks
tbhattacharjee
|
|
|
|
|
|
UML is a part of Ultimate.
Sometimes I wish I could justify that particular expense.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
If you just want UML, then use Visio Pro; with Standard (or the "Student") you can usually find free templates on the web for UML.
Visio "Architect" is what you're otherwise referring to; i.e. generate software out of Visio / reverse engineer.
|
|
|
|