.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

Telling the program what you won't be doing to make the code run faster

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net
 

I need to know if my thinking is on the right track about something, and if so, what keywords I might Google search to find out more about this.

Are there times we write code and the real advantage is that by telling the computer what we won't be doing, it saves time because the computer doesn't have to do something (maybe saving milliseconds, or even more?)

For example, every discussion about the modifier 'abstract' explains how it will prevent me from accidently trying to instantiate an object from the class.  Well, I'm in a situation where I'm pretty sure I won't make that mistake, but then I was thinking, well, maybe there's a better reason to use 'abstract' -- maybe it tells the computer 'you don't have to do certain stuff because this an abstract class' and it creates a significant time savings.

Am I on the right track?

The closest I've come to finding this was a mention that it's good to mark classes with 'sealed' whenever you know you won't be inheriting from them; this was in article about making code work faster.

Thank you for your help with this.




View Complete Post


More Related Resource Links

Make sure that the class defined in this code file matches the 'inherits' attribute, and that it e

  

Here is the page directive for the page that throws the error:

<%
@ Page language="c#" Inherits="University.AspNet.Index" CodeFile="Index.aspx.cs" %>

The code behind file Index.aspx.cs starts like this:

using University.Framework.UI;

namespace University.AspNet

{
      
public partial class Index : University.Framework.UI.HomePage

The code behind is extending this HomePage class, which is in turn an extenstion of another class University.Framework.UI.Page, which extends the System.Web.UI.Page class.

Am I misusing the I

.NET Code Tuning: Make Your Apps Fly with the New Enterprise Performance Tool

  

Because the common language runtime (CLR) is a black box, it's pretty hard to divine what's going on when you want to track down performance problems. Microsoft will be delivering a brand new profiler, the Enterprise Performance Tool (EPT), as part of Visual Studio 2005 Team Developer Edition that's ideal for use on a production system because it offers some very lightweight means of collecting performance data. Here John Robbins takes you on a tour.

John Robbins

MSDN Magazine December 2004


C++: Write Faster Code with the Modern Language Features of Visual C++ 2005

  

The next version of Visual C++ has a new syntax that is both elegant and powerful. It has new optimization technology that has improved the speed of Microsoft. It has new compilation modes that ensure Common Language Infrastructure compliance and verifiability for the .NET Framework, and it has new models for interop. In this article Stephen Toub explains these and other improvements to Visual C++.

Stephen Toub

MSDN Magazine May 2004


Debugging: DataTips, Visualizers and Viewers Make Debugging .NET Code a Breeze

  

There is a whole host of new goodies in upcoming release of Visual Studio 2005 that will enhance your debugging experience. One such improvement will make it easy to visualize types within the debugger. This article discusses those improvements and covers debugger attributes and type visualizers. In addition, the author shows you how to extend the display of your own types with custom attributes and how to plug in an assembly to visualize.NET types built into the framework.

Morgan Skinner

MSDN Magazine May 2004


How to make expanding/collapsing CollapsiblePanelExtender from code behind smooth and animated

  

I've got a CollapsiblePanelExtender in place on a panel in test and it works like a champ. (I get excited about the simplest things).  When I click the panel header it expands and collapses with smooth animation, as expected and desired.

But when I change its state via code behind, it seems I am merely changing its state and somehow bypassing the javascript that controls the smooth animation.

My markup is out of the box. I have added code behind and some javascript, but I am missing the connection.  Here is the javascript:

function pageLoad(sender, args)
{
    smoothAnimation();
}

function smoothAnimation()
{
    var collPanel = $find("CollapsiblePanelExtender1");
    collPanel._animation._fps = 45;
    collPanel._animation._duration = 0.50;
}

 

And here is the code behind:

protected void btnExpand_Click(object sender, EventArgs e)
{
    this.CollapsiblePanelExtender1.Collapsed = false;
    this.CollapsiblePanelExtender1.ClientState = "false";
}
 

protected void btnCollapse_Click(object sender, EventArgs e)
{
    this.CollapsiblePanelExtender1.Collapsed = true;
   

How to make "UserId" equal to the "logged-in user" in vb code behind

  


I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator). Thanks very much.

 

Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

        If Request.QueryString("UserId") IsNot Nothing Then
            ' Get the connection string from Web.config.

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
                ' Create a command object.
          

How do I make the program's name appear in the taskbar?

  
I've written my first WPF app, which is a page-based application.  (Not an XBAP app.)  I wrote it in VS 2010 on my Windows 7 machine.  I've put it onto a user's machine, she's running Windows XP SP3.  I've noticed that when she runs it, the title of the program doesn't show up in XP's taskbar.  I never noticed this in Windows 7. So, what I have done wrong and how do I correct it?  Rod

How to make backup for Access DB with Code using ADO.net and C#?

  
Hello , How to make backup for Access DB with Code using ADO.net and C#? ThanksKareem Naguib

how to make working WPF 2010 program make changes to SQL Server 2008 Express files

  
(1) I have a working WPF 2010 program that manipulates a table in SQL Server 2008 Express (2) the program does delete, update, select and insert correctly however in its own project file folder logbooklmk.mdf   logbooklmk_log.ldf (3) I want the actual SQL Server 2008 express files to be changed yes I know the issue is sharing and the copy option only applies to the local project files. I found this out by trying always copy, never copy and copy if newer. I probably have to change the .xsd folder to refer to the actual SQL Server 2008 Express file. Tried that once and it failed. Something about sharing not allowed.

How do I obfuscate .Net IL code using command line program?

  
How do I obfuscate .Net IL code using command line program? I want free tool that can be deployed to obfuscate DLL generated from compiled tool?

How to create Asynchronous website-make the site work faster?

  
Hi,I developed an ASP.NET 3.5 website to read a few XML files generated by a third party software and convert them to a single Excel Book. The entire process takes more than 1 HOUR and even before completing the entire work, the system comes back with a message like - "Page cannot be displayed" and it fails. So, I am planning to make this website an Asynchronous site (I think if I make this site asynchronous it will work faster and will not stop execution before completing - new ideas are welcome.) I am new to this concept. Can anyone help me with some examples of how to convert a normal website to Asynchronous website? At present my site has 3 tiers and the reading of XML pages and writing them into Excel are happening in the Data Access Layer.Thanks

Making the program make text boxes according to a num of a variabe

  
i have a text abox that the user need to enter a number then according to this number the program need to show text boxes

How can I make this code work?

  

I have this code it is work almost correctly but now this code populated data to ALL comboboxes at the time(in the start of UI) the User open the UI.

I need to split the code so when the User select value in combobox corporationCode1 I will advance to combobox WorkSpaceCorporation

for some like this if user select something in combobox CorporationCode1 so advence to combobox WorkSpaceCode..

There is a code/

private void Window_Loaded(object sender, RoutedEventArgs e)

        {

    

Getting the "Do you want to allow the following program to make changes to this computer?" question

  
My company is developing a program that when it's installed on a Client Windows 7 computer, the user (which is a Standard User, but program was installed by an Administrator) is getting the "Do you want to allow the following program to make changes to this computer?" question.  This wouldn't be so bad, but the program is forcing a login by the Administrator to allow the program to run.  The message box is showing "To continue, type an administrator password and then click Yes."

I have digitally signed the application hoping that would have eliminated this but still getting the login prompt.

The users could live with the prompt about the confirmation, but why is the administrator's login being required?

If it matters the computer I'm testing this on and getting this result is a Windows 7 Professional 64bit.  The program executable is a compiled VB.Net windows application using VS2008.  The executable itself is compiled for an x86 CPU type due to one 3rd party control we are using which isn't AnyCPU compatible.

Mike...

make a control required field using code in infopath

  

Hello guys,

How do i make a field required field using code. Specifically, how to make attachment control mandatory.

I know there is an option to select cannot be blank in properties but i want to do it conditionally.

Please help me.

 

 


Here is my new control code i couldnt make it so if i change the control size on form1 designer so i

  

I have two major problems.

1. After dragged the control to form1 designer when im on form1 designer i dont see anything in the control only when i run my program. I thought ill some kind of preview or what i painted in the control ill see it on the form1 designer before i run my application.

2. On form1 when i manualy stretch the size of the new control on form1 designer to be bigger or smaller the things i painted dosent fit i thought the way i created the code in the control code it will keep its size arroding to the size changed ill do in form1 designer but it dosent.

 

So here is the code of the control and form1 can someone help me with this two problems show me the correct code?

 

First the control code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DannyGeneral;

namespace My_Diet_Control
{
   
    public partial class My_Diet_Graph_Control : UserControl
    {
      
        int x_axis_lenght;
        int y_axis_lenght;
   &

Here is my new control code i couldnt make it so if i change the control size on form1 designer so i

  

I have two major problems.

1. After dragged the control to form1 designer when im on form1 designer i dont see anything in the control only when i run my program. I thought ill some kind of preview or what i painted in the control ill see it on the form1 designer before i run my application.

2. On form1 when i manualy stretch the size of the new control on form1 designer to be bigger or smaller the things i painted dosent fit i thought the way i created the code in the control code it will keep its size arroding to the size changed ill do in form1 designer but it dosent.

 

So here is the code of the control and form1 can someone help me with this two problems show me the correct code?

 

First the control code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;<


danieli
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend