|
I've wondered about this for a while. Is this genuinely useable for a real project or is it just a toy? I mostly use C# at work but I have a Mac at home; it'd probably be easier to get myself writing more C# if I had the motivation of being able to use what I'm writing at home.
|
# ¿ Jun 18, 2013 03:19 |
|
|
# ¿ May 15, 2024 19:39 |
|
Since there's all this talk about modules, in practice what makes a static class so different from a module? I've worked with C# and VBA so I can pretty much understand VB.Net but I haven't used it for anything really RICHUNCLEPENNYBAGS fucked around with this message at 00:25 on Jun 21, 2013 |
# ¿ Jun 21, 2013 00:21 |
|
Ithaqua posted:http://stackoverflow.com/questions/881570/classes-vs-modules-in-vb-net Well, if I'm reading this right, basically modules are static classes.
|
# ¿ Jun 21, 2013 00:46 |
|
edmund745 posted:There seems to be accounts of before Microsoft allowed TFS Express to work with VS Express--and also accounts of after, when they did. And the TFS Express use terms don't clear much up. OK, so, make a mercurial repo and store it on Dropbox or something. You need to know like three commands to do what you want and they're all here: http://hginit.com/01.html
|
# ¿ Jun 21, 2013 02:34 |
|
lovely Treat posted:I need to convert a small VB6 app to VB.net is there any software that can convert it semi reliably so I only need to fix a few things or will it be a complete mess and I'm better off starting over from scratch? Even if there were such a tool (I don't think this is), the output would not in any way resemble best-practice VB.Net code.
|
# ¿ Jun 24, 2013 12:39 |
|
Is there a decent reference I could refer to understand like, enough of C++ that I can read documentation on Win32 stuff and understand it well enough to work with it in C#? I mean in particular I have trouble understanding what all the data types for arguments to functions are supposed to be.
|
# ¿ Jun 28, 2013 00:57 |
|
GrumpyDoctor posted:If you're trying to wrap your head around P/Invoke stuff, the piece you're missing isn't C++ knowledge. P/Invoke is just a pain. Maybe give something like this a shot? Like look at this: http://msdn.microsoft.com/en-us/library/windows/desktop/bb530498(v=vs.85).aspx I don't really know what HWND, LPCWSTR, or DWORD are supposed to be and I feel like I'd probably understand it better if I had some basic knowledge of Windows C++ programming? I mean you can look these things up one-by-one I guess, but that's a pain and leads to a really shallow understanding.
|
# ¿ Jun 28, 2013 01:32 |
|
I asked this question in the Excel thread, but maybe it would be better here. Is there a book or resource you folks recommend for VSTO? I'm not starting from zero because I have spent a fair amount of time with VBA so I have some appreciation for the Word/Excel object models but I'd like to be able to make real add-ins.
|
# ¿ Jul 24, 2013 01:42 |
|
thezoidburg posted:You may know this already, but since its the .Net thread, don't forget you can write add-ins in JavaScript and HTML now so they can run on both local office and web versions. I don't know exactly what platforms these add-ins can target however (new ipad apps too?) I'm aware of this, but from the sound of it it's way more limited than VBA (except that you can talk to Web services, which is cool I guess but I don't know what I'd do with that).
|
# ¿ Jul 25, 2013 01:47 |
|
OK, so, I'm just going to go ahead and ask this even though I think it's probably a stupid question. I'm trying to start getting into unit tests. I haven't ever really used them before. I'm working on an MVC project with data being persisted with EF CodeFirst (it's a week old so there aren't mountains of legacy stuff or anything). So it seems like the preferred way of doing this is creating an interface, then having my data store implement that interface, so that I can also have a pretend repository implementing it that I'll use in my tests. I mean, OK, I get that in theory, but how does this work in the real world without me totally reimplementing all the canned stuff I'm getting with the ApplicationDbContext and the various methods UserManager is offering to do user-related stuff (using ASP.Net identity instead of handrolled stuff)? Most of the examples I see are talking about rolling your own, which makes the concept easy to understand but I'm not seeing how it's supposed to work in an actual project instead of just something that's a toy. I realize there are huge books on this subject but I'm also learning Entity and MVC through this project so I'm not too keen on reading a big tome just on DI or unit testing; I'd like some material that I could basically look at in one sitting. Also, while there are probably valid reasons not to use some of the canned stuff I'm talking about the project I'm working on is on a tight schedule where being able to use premade stuff is a big help. edit: In case this is like total gibberish I'm talking about starting with the MVC project type that already has identities and login/registration all built in out of the box. RICHUNCLEPENNYBAGS fucked around with this message at 05:30 on Dec 28, 2013 |
# ¿ Dec 28, 2013 04:39 |
|
Ithaqua posted:The role/membership provider uses a lot of static classes, which makes life trickier. Encapsulate all of the membership provider stuff up in a class and then inject an implementation of that class to your controllers. Then you can mock the data it returns. So you mean I should just create another class that's going to wrap all the UserManager methods?
|
# ¿ Dec 28, 2013 17:10 |
|
I mean... am I really making that better by building another class that's just going to call those methods? I'm missing something here.
|
# ¿ Dec 28, 2013 18:13 |
|
OK, I think I'm following now. So if I can go ahead and ask a dumb follow-up question: that seems pretty straightforward. What's the advantage of using a whole DI framework?
|
# ¿ Dec 28, 2013 19:05 |
|
MVC question: If I put a DbContext in the constructor of a controller, what is the lifecycle? Will it be disposed of when a request is handled? Does it cause concurrency issues?
|
# ¿ Dec 31, 2013 14:55 |
|
The specific use I have in mind is instantiating a new instance DbContext in the constructor and then disposing of it in the controller's Dispose method.
RICHUNCLEPENNYBAGS fucked around with this message at 00:18 on Jan 1, 2014 |
# ¿ Jan 1, 2014 00:15 |
|
I get why you're saying that but I just wanted to know if the controller's Dispose was going to happen with every request.
|
# ¿ Jan 1, 2014 08:12 |
|
Why not have a disposable data access class instead of wrapping every single method in using?
|
# ¿ Jan 2, 2014 14:05 |
|
Right, but why should the lifespan be so different if it's getting disposed after every request? I'm not talking about a static connection or anything. e: This is a genuine question; I hope I'm not giving you the impression I'm challenging you because you obviously have more experience with MVC than I do. RICHUNCLEPENNYBAGS fucked around with this message at 05:12 on Jan 3, 2014 |
# ¿ Jan 3, 2014 02:00 |
|
Che Delilas posted:It's not necessarily bad on a technical level (that I know of), though I'm sure there are some corner cases where it won't get disposed the way you expect. It's more a design issue. Spraying data access logic at your Controller classes severely breaks separation of concerns, which is the point of MVC to begin with. Data access is such an orthogonal issue to an MVC app that it really should be handled in its own place; at minimum in its own class (some projects have it in its own project entirely). And really, moving each linq query out to its own method in a data access class somewhere doesn't really add a lot of complexity at all, if you don't bother with doing full dependency injection. I understand that, but what if you have a separate class that, say, has methods like GetMyObject() or SaveApplicationObject() or whatever, rather than directly making DbContext calls, and that class is itself disposable? Then you can dispose it in the controller's dispose method and if you're using an interface you could go back and mock it later (yeah it should probably happen at the same time but I'm working on a really tight deadline to have a first release).
|
# ¿ Jan 4, 2014 22:52 |
|
Ithaqua posted:I saw a great presentation by Dustin Campbell from Microsoft last week. He talked about the future of C# and mentioned some cool stuff they have planned for C# 6. This is all great. I'm glad to see them moving in a direction that is gradually reducing boilerplate you have to write.
|
# ¿ Jan 15, 2014 05:55 |
|
You know, as useful as ReSharper is sometimes I wonder about the suggestions. Some of the Linq query replacements for loops are kind of difficult to read. I mean, not so difficult you can't look and figure out but that's a distraction.
|
# ¿ Jan 15, 2014 14:03 |
|
Dietrich posted:I personally despise the from whatever select x, y syntax for using linq, and stick with the whatever.select(w => new { w.x, w.y}); syntax, but maybe it's just me. Either way a lot of the time resharper makes good suggestions more than a majority of the time. I agree. But it suggests them for foreach loops too and honestly sometimes it gets a little heady for my tastes.
|
# ¿ Jan 16, 2014 03:51 |
|
Bognar posted:The things that ReSharper can generate from a foreach loop is absolutely mind-boggling. Why yes, of course I wanted this readable and understandable foreach block to be re-written with 3 SelectManys, 2 Aggregates, and a GroupJoin. Also, I guess I can configure this somehow, but I don't like how it suggests I eliminate named parameters everytime I use them. I'm using them because it's confusing without them! Come on. Also, I have ReSharper set to indent everything GNU-style, which is great, but it clashes with Visual Studio sometimes which is unfortunate. I mean I would just set VS to use GNU-style if it were an option.
|
# ¿ Jan 16, 2014 04:57 |
|
What kind of project only ever calls methods defined by the project itself? Some of Microsoft's own stuff has like a billion overloads and optional arguments.
|
# ¿ Jan 16, 2014 05:37 |
|
That's all well and good but I think it's a little bit simplistic to say any code that is easier to read with named parameters is wrong. If that were really the case why would they have added such a feature at all?
|
# ¿ Jan 17, 2014 00:21 |
|
Well, fair enough, I suppose. I like to use them even when there aren't a lot of arguments. Particularly with bools because it's not obvious what you were specifying when you put "false" in something.
|
# ¿ Jan 17, 2014 00:46 |
|
I can't say I'm a huge fan of parameter objects either; for all the reasons you've discussed. And in any case it's hardly getting at the root of the problem (assuming it is one and you don't have a legitimate need for lots of parameters).
|
# ¿ Jan 17, 2014 02:59 |
|
Bognar posted:We were talking about this at work today and my co-worker convinced me that being able to return anonymous types would be a better solution. It's a bit quirky, but it allows you to have named properties instead of just relying on the position in the tuple. It might look like: So return a dynamic then. I mean I know people are afraid of them but they're useful for any number of things.
|
# ¿ Jan 18, 2014 03:55 |
|
Bognar posted:I honestly wish dynamics had never been added. I get that they're useful for making COM interop code not look terrible, but I feel like the solution is to build a sane wrapper API around common COM interaction rather than adding duck typing to a statically typed language. I don't have a problem with duck typing in and of itself, I just don't want it littered throughout my statically typed code. The compiler will check my errors in all my statically typed code, but the compiler only looks like it's checking my errors in dynamically typed code. Dynamic dispatch is a really useful idiom, anyway. I don't think anonymous types are really all that much "better" than dynamics in any of the aspects that bother you about dynamics.
|
# ¿ Jan 18, 2014 23:55 |
|
Bognar posted:Except that anonymous types offer compile time type safety. I just don't see what kind of sense it makes returning them. If you think you're going to need the object in multiple places you should actually define it. Otherwise it seems to me you're getting an inappropriate level of coupling between methods. As for type safety, if you want you can cast a dynamic to get Intellisense or whatever. But to be honest I think the chances of this kind of error aren't super-high and also they're going to be really obvious when you run across them. RICHUNCLEPENNYBAGS fucked around with this message at 17:54 on Jan 19, 2014 |
# ¿ Jan 19, 2014 17:51 |
|
Ender.uNF posted:You are coupled to the method by definition. If I change the return type from byte[] to int, bool to float, or Frobber to Gobulator you're just as tightly coupled as if I were returning { x, y }. If I change the parameter list, other than adding new optional parameters or some limited type changes, all my callers must be updated. If I add, remove, or change out/ref parameters I just broke your poo poo yo. Except now instead of reading a class definition to find out the properties of an object, you're going and reading through a method. This isn't really good design.
|
# ¿ Jan 20, 2014 04:27 |
|
Bognar posted:Sure, when you run across them at runtime as opposed to never having the problem at all because the compiler handled it all for you. I don't understand why you would willingly throw away the compiler's error checking when it's basically free. Yeah, great, but this is so trivial that I don't think it's worth worrying about. Using dynamics can save you from writing a lot of extraneous code.
|
# ¿ Jan 20, 2014 04:29 |
|
Bognar posted:I don't disagree that dynamics have their place, I just don't think that place is to deal with multiple return values when you could use tuples, anonymous types , or concrete classes instead. Well, I probably wouldn't use them for your use case, but like I said, I have a philosophical objection to the idea of returning an anonymous object. I just think it's unfortunate that there are so many folks in the C# community who have a pathological aversion to any technique requiring some care when being used.
|
# ¿ Jan 21, 2014 00:37 |
|
SweetKarma posted:Is there any reason I shouldn't learn VB as my first .NET language? C# seems to be the more popular language at the moment and it makes me wonder if I should learn it instead of VB since there will be more learning resources. Frankly my only reason for learning VB is that I'm burnt out on C-style syntax. There is close to zero difference in capabilities but C# developers tend to earn more on average if that is important to you.
|
# ¿ Jan 22, 2014 04:41 |
|
Dietrich posted:My intention was to demonstrate the difference in verbosity between VB and C# when using generics and lambda expressions, not to write the shortest code in either language. I don't think verbosity si a big deal with .NET languages because of Intellisense. Certainly C# itself is quite verbose compared to some other popular languages and typical style also uses variable names that are, comparatively, long.
|
# ¿ Jan 23, 2014 00:50 |
|
Ithaqua posted:First off, answer this question: Why do you want to use Git over standard TFVC? Git is generally a lot harder to use effectively. Full disclosure: I am massively biased against Git. How do you figure?
|
# ¿ Feb 4, 2014 03:29 |
|
2banks1swap.avi posted:We did once! But now we don't. Not sure why. I think that was meant to be a suggestion, rather than a question.
|
# ¿ Feb 5, 2014 05:35 |
|
This is more curiosity than anything else, but do any of you have any of the C# certifications MS puts out? Is there any reason to be interested if you're already a working developer?
|
# ¿ Feb 19, 2014 01:11 |
|
wwb posted:I haven't spent any measurable time with the new identiy framework though it looks good and I don't see why you couldn't easily roll your own plumbing for the raw ADO.NET bits. I have; the current project we're working on uses it because we were time-constrained. You get users, hashed passwords, roles, and claims, which is nice. But there are some weird things (like you don't have to have a password for an account) and you're going to end up doing some stuff on your own unless you don't need to have password reset or changing usernames or a couple other features. I think it would be miserable or at least pointless if you aren't using EF though.
|
# ¿ Feb 28, 2014 00:52 |
|
|
# ¿ May 15, 2024 19:39 |
|
To use EF and not end up with an unmaintainable mess you have to know how databases work and what EF is doing under the hood so I don't think you're going to remove the need for them to understand SQL entirely (even if you don't care how it ends up you need to have relationships on your objects going both ways to get cascading delete under certain circumstances and if you don't bother to do that you'll just get EF errors when you try to delete stuff which are gonna be a pain). I don't know much about the performance characteristics if you have crazy scale. My project doesn't have gazillions of users. I don't notice the overhead. But anyway, my point is I would recommend it for people who already know SQL but don't want to bother hand-mapping everything, not people who don't know anything about SQL and are hoping to avoid learning. I'm using Code First though; I guess some of these things might play out differently with DB First. RICHUNCLEPENNYBAGS fucked around with this message at 01:35 on Feb 28, 2014 |
# ¿ Feb 28, 2014 01:29 |