|
I have a C# question. Suppose I have a class Shape, with a private string member name and a public member function (method?) printName which simply returns name. I then create 3 derived classes: Square, Circle, and Triangle, each with a private string member name. If I call printName on derived class objects, will it function as intended? Or do I need to define a printName in each of the derived classes?
|
# ¿ Aug 7, 2010 16:33 |
|
|
# ¿ May 22, 2024 08:05 |
|
This is more or less what I have:code:
edit: I'm just reading a tutorial on properties now. I guess the C# preferred way of returning the name is with code:
Adahn the nameless fucked around with this message at 17:38 on Aug 7, 2010 |
# ¿ Aug 7, 2010 17:26 |
|
gibbed posted:I prefer abstract properties in this situation: Thanks for your help. I'll have to look up how .GetType().Name works. I used abstract properties and it worked. But I have a few questions: What's the difference between declaring something abstract and declaring it virtual? Also, I think I could have made Shape an Interface because I don't plan on instantiating any Shape objects. Would that have been better than making it an abstract class?
|
# ¿ Aug 8, 2010 19:35 |
|
I'm trying to create an adorner in WPF that will let me resize a FrameworkElement in a Canvas. So I've got my ResizableAdorner and my ResizableThumb. My question is: Do I need to create default styles for both controls? The way I envision it, the thumb lies on the adorner layer, and when some criteria are met, I display the layer, otherwise it's hidden.
|
# ¿ Mar 3, 2011 02:51 |
|
I have a class that has a Point structure, _dragStartPoint, as a member variable. I can't figure out this line of code: code:
code:
|
# ¿ Apr 13, 2011 03:58 |
|
2banks1swap.avi posted:When ran locally, our web project has some pretty slow loads at times, and most of it is actually generating markup, apparently - 11.6 seconds in total to just load a drat page! You're .Net on MVC, right? Assuming I understand your problem, a relatively easy solution: Cache the lookup data in memory on the server using .Net's memory caching api. (I'm assuming you aren't talking about a ton of records here). This is per process, so it's per app pool in your case, but if it's just some lob app that farts data on a screen I doubt it'll be an issue. I don't know if your team has authority to deploy an external cache that more than one process can hit. That'll cut down on the db requests. If you wanted to get fancy, you could also cache in the browser local storage to cut down on the http requests.
|
# ¿ Apr 15, 2014 15:50 |
|
gariig posted:First I would find out what is taking so long. You need to know what is wrong before you fix it. You might end up highly optimizing a part of your application that's only 50ms and missing the 2000ms calls elsewhere. I'd start with the Visual Studio Performance Profiler to find the hot spots in your code. You might need to get whoever is hosting the database involved because it could be unoptimized queries (SQL Server Profiler). Once you know the hot spots you can start to develop ways of overcoming them. It could be using async/await to make multiple slow web service calls in parallel. It might be caching (ASP.NET caching, Memcache, etc). Maybe you need to put a web service next to the database so you can send one request to the web service for all of the data needed to build a website. All of that is really good advice. I was assuming you'd profiled and determined that the db queries were causing the slowdown. If you haven't, definitely gather solid evidence before you take prospective solutions to your team. Also, I missed that you're only seeing this issue in development? If it's not slow in production, caching is probably overkill because of the amount of complexity you're adding. Are you connecting to a remote database over a vpn or something?
|
# ¿ Apr 15, 2014 16:43 |
|
|
# ¿ May 22, 2024 08:05 |
|
I'd mention biz spark and dreamspark as ways to grab free versions of ms paid products.
|
# ¿ Jun 18, 2014 22:43 |