C# - Rewriting Existing Functionality In The .NET Base Class Library

Apr 14, 2009

Relating to another question I asked yesterday with regards to logging I was introduced to TraceListeners which I'd never come across before and sorely wish I had. I can't count the amount of times I've written loggers needlessly to do this and nobody had ever pointed this out or asked my why I didn't use the built in tools. This leads me to wonder what other features I've overlooked and written into my applications needlessly because of features of .NET that I'm unaware of.

Does anyone else have features of .NET that would've completely changed the way they wrote applications or components of their applications had they only known that .NET already had a built in means of supporting it?

It would be handy if other developers posted scenarios where they frequently come across components or blocks of code that are completely needless in hindsight had the original developer only known of a built in .NET component - such as the TraceListeners that I previously noted.

This doesn't necessarily include newly added features of 3.5 per se, but could if pertinent to the scenario.

Edit - As per previous comments, I'm not really interested in the "Hidden Features" of the language which I agree have been documented before - I'm looking for often overlooked framework components that through my own (or the original developer's) ignorance have written/rewritten their own components/classes/methods needlessly.

View 5 Replies


ADVERTISEMENT

Create A Class Library That Has Forms To That The Users Can Perform Some Functionality?

Mar 14, 2008

I want to create a Class Library that has forms to that the users can perform some functionality. Is that possible in VS 2008? I believe it is, but can't find any examples out their to provide a template or a guide to create mine. What I am trying to do is put common functionality in a class library to multiple applications that I create can access this class library to perform some functionality.

View 3 Replies

C# - Additional Functionality Into Existing ASP.NET App?

Mar 16, 2012

adding certain functionality to an existing ASP.NET application running on IIS 6.0 programmed in VB.NET.To aid in future development the client wants the additional functionality to be as future proof as possible. Ideally i have said that I would like to push for a solution using ASP.NET MVC3, running off IIs 7.5 and .NET 4, written in C#. This solution would act as a seemless addition to the current web-portal appearing probably just as an extra tabbed page.

But they will be completely seperate web-apps. Which is crucial.The main problems i can forsee are firstly sharing session particulars between the asp.net web app and the new application. Particularly with regard to maintaining session state (and not having IIS timing out on one of the apps). Also, conjoining the two "apps" appears problematic in my head, although this may be far simpler than i fear.

1) Embed the new fuctionality into the existing codebase (not a great option). This would mean losing any potential future upgrade-ability and also means not following better OO conventions by utilising the MVC framework.

2) Using an iFrame to link to the razor pages of a seperate MVC3 app (the one im favouring currently). Allows uses of all new technologies, however downside is sharing session data. Either through iFrame "attributes" through persisting a session state to a db? (slow?) or even some kind of web service interaction between the applications to push/pull user/session data?

View 2 Replies

Add Wcf Functionality To An Existing Website Project?

Dec 27, 2011

I have several asp.net website projects for various sites.Currently I want to add REST API's to these projects so I can start developing mobile apps (using HTML5/JavaScript/CSS3 and PhoneGap) that make use of these webservices.

Since WCF is far more powerful than regular asp.net webservices (among others with control over the service and authentication/authorization), I'd love to add these to my existing website project.

I did a Google search but cant find anywhere a step-by-step tutorial how this can be done. And also if there's any functionality I'd possibly loose when adding WCF functionality.I was also thinking of creating a new project specifically for WCF, but think I'd rather add it to an existing website project.

View 2 Replies

Error - Base Class 'System.Windows.Forms.Panel' Specified For Class 'MenuButton' Cannot Be Different From The Base Class 'System.Windows.Forms.UserControl'

Mar 12, 2010

When I do this

Public Class cInherits : Inherits Panel

I get this: Base class 'System.Windows.Forms.Panel' specified for class 'MenuButton' cannot be different from the base class 'System.Windows.Forms.UserControl' of one of its other partial types.

How do I inherit?

View 4 Replies

Form Inheritance - Error1Base Class 'MenuStrip' Specified For Class 'Lesson2' Cannot Be Different From The Base Class

Apr 15, 2010

I have put this code in the global form Inherits System.Windows.Forms.Form. And then in the form that will inherit this from the global Inherits MenuStrip. "MenuStrip" is what the global form is called. But keep getting this error: Error1Base class 'MenuStrip' specified for class 'Lesson2' cannot be different from the base class 'System.Windows.Forms.Form' of one of its other partial types.

View 5 Replies

VB2010 Class Library: Create A Static Library Instead Of DLL?

Jun 21, 2011

I have a Visual Basic Class Library project. It generates a DLL. Is there a method to generate a static .LIB to which I can do a static link?Alternatively, can I do a static link against a DLL?

View 6 Replies

Invalid Character In A Base-64 String Adding "Change Password" Functionality For Adminstrators?

Mar 31, 2010

I've done some searching on these forums as well as on the Web in general, and while I've found some posts about the error above, I haven't seen anything specific to what I'm experiencing

View 4 Replies

Decimal To Alphanumeric Number Base Converter Library In Program?

Mar 16, 2012

I'm looking for a decimal to alphanumeric number base converter library in Visual Basic that does not use recursion. [url]...

which includes a demo app but discovered that it uses recursion. The problem with it using recursion became apparent when I attempted to integrate the library into my own Visual Studio Express 2010 Visual Basic project: I got a stack overflow exception.

Now I could consider increasing the size memory allocated for the stack but it might be hard to determine what this would be, given that the recursion depth might vary depending on the value to be converted.

View 1 Replies

Create A "wrapper" DLL To Provide Additional Functionality On Top Of An Existing DLL?

Jan 19, 2009

I'm trying to create a "wrapper" DLL to provide additional functionality on top of an existing DLL. Here's what I'm doing, it may be the wrong approach.The existing DLL is basically a .net version of WinSock. It has lots of public methods and events.The DLL I'm trying to create will provide specific file processing methods, and notification events, which will then utilize the WinSock DLL totransfer the files. This wrapper Dll is intended to encapsulate all of DLL #1 methods and events.

So what I'm doing is having my new DLL reference the existing one, and create a new set of events, some of which get raised by handling DLL #1 events.So I end up with two DLLs, one of which is dependent upon the other. When I try to use my DLLS in a Forms app,I am able to use my wrapper to call methods in the WinSock DLL. Some events that are raised within my wrapper are properly handled by the forms app.The events that do not work (get raised) are the ones which are raised by handling the other DLL's events.This seems to be because the WinSock DLL's events never get raised, when they apparently should be. The WinSock object in question was declared as "WithEvents".

View 1 Replies

Create A New Class That Inherits From The Base Form Class And Define A New() Method With Parameters?

Oct 1, 2008

I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).

[Code]...

View 6 Replies

Call Method Base Class In Program Passing Sub Class Objects?

Apr 22, 2012

Base class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.

[Code]...

View 5 Replies

.net - Suppress A Property Or Method From A Base-class In A Derived Class?

Apr 7, 2011

Supose a base class

Public Class airplane
Private var_num_seats As Integer
Private var_num_engines As Integer

[code]....

Obviously, I don't wish that the class Glider has the method "start_engines" neither the property "num_engines". Otherwise, other child classes may have. How can I supress these property and method in child class, not just ignoring (if I can)?

View 2 Replies

.NET Class Inherits A Base Class And Implements An Interface (works In C#)?

Apr 9, 2010

I am trying to create a class in VB.NET which inherits a base abstract class and also implements an interface. The interface declares a string property called Description. The base class contains a string property called Description. The main class inherits the base class and implements the interface. The existence of the Description property in the base class fulfills the interface requirements. This works fine in C# but causes issues in VB.NET.

[Code]...

View 5 Replies

Can't Inherit Shared Properties From A Base Class In A Child Class?

Dec 29, 2010

This is another one of my "I think it's not possible but I need confirmation" questions.I have a base class for a bunch of child classes. Right now, this base class has a few common properties the children use, like Name. The base is an abstract class (MustInherit)Technically, this means that everytime a child class is instantiated, it lugs around, in memory, its own copy of Name. The thing is, Name is going to be a fixed value for all instances of a given child. I.e., Child1.Name will return "child_object1", and Child2.Name will return "child_object2".

View 1 Replies

Does An Inherited Class Automatically Implement An Interface From Its Base Class

Jun 10, 2011

Suppose I have piece of code like this:

Public Interface ISomething
....
End Interface

[code]....

View 2 Replies

Returning A Inherited Class As Base Class Type With Web Services?

Sep 25, 2009

I suspect I am being very silly here but I have the following setup

Class MustInherit myBaseClass
'some stuff
End Class
Class myInheritedClassA

[code]....

Running this results in the following error

Unhandled Exception: System.InvalidOperationException:
There was an error generating the XML document. --->
System.InvalidOperationException:

[code]....

is there any way of 'Widening' the inherited class to the base class so this would work?

EDIT:regarding XmlInclude(typeof inheritedClass), currently this method could potentially return a number of types of inherited class (i.e myInheritedClassA and myInheritedClassB) is it case of simply having to add each of the inheritedTypes in this tag?

View 2 Replies

Access The Base Class Inside A Derived Class?

Oct 22, 2010

How do I access the base class inside a derived class?

View 1 Replies

Get Base Class Object Reference Outside The Class's Definition?

Dec 10, 2010

If we are within the derived class then ofcource we can use MyBase keyword to access base class's object reference . That's fine , how can we take that base class's object reference outside that derived class's definition.My following code will explain what i want . Actually that is giving error right now, but it is explaining my requirement .

Public Class Base
Public x As String
End Class

[code]....

Actually there is error in ReadOnly Property BaseReference's Getter . Error is "Error 1 'MyBase' must be followed by '.' and an identifier. " how can i get base class object reference in Main method ?

View 1 Replies

Base Class Collection With Sub Class Objects

Jul 19, 2010

[code]The reason that this is a problem is that this is a collection of EventBase objects, but I'm trying to populate it with child classes instead. For example, I might have a JumpEvent class that inherits EventBase, and this is being put into the EventBaseCollection. That means that value.GetType() returns the type of JumpEvent, which as you might guess does not equal the type of EventBase.The goal of course is to simply loop through all of the various events without having to know anything about the sub-classes. Is there a way to determine the type of the base class so that the OnValidate call will work? Or is this just the wrong way to go about it altogether?

View 2 Replies

Convert From Base Class To Inherited Class?

Jun 2, 2009

I understand that inherited classes can't be converted from base classes. But is there any way to write a conversion sub, so that the base class gets assigned to MyBase, then extra properties are added?[code]...

View 7 Replies

Add / Implement An Interface To An Existing Class Without Changing Code Anywhere That Call The Class And Functions

Mar 1, 2010

I need to create unit testing project for my current website. The currentw ebsite si written in VB. All unit testing examples are using interface to create mock object. My current VB class does not implment any interface. Can I add interface and implement it to my current class and functions without affecting or changing codes to any pages in my website that call the functions? For examples my current class is like:

[Code]...

View 2 Replies

Adding A Windows Service Class To A Class Library

Feb 14, 2012

I have a class library in VB.NET that does a NET-envelope for an USB device driver.There is only one function of that driver that I could not envelope in a traditional class, but I had to put it in a Windows Service as described here:Sharing a class property (field) between applications.The Windows Service works fine, but I have now two projects for my NET-envelope: the one with the class library, the second with the windows service and I do not like the idea to maintain two distinct projects for the same driver.Is it a good practice (or even if possible) to add a windows service class to a normal class library (without creating its own project as described in the vb tutorial)?I know, in any case I should create a separate setup only for the windows service, but in this way I could have together all the classes that envelope my usb device driver in only one project.

View 1 Replies

Creating An Instance Of A Class From A Class Library?

May 18, 2010

I've createda vb.net class library where I've defined a number of small classes... nothing complicated, just working with strings, sending emails, etc.In another project, I reference the class library and I'm seemingly able to create an instance ofone of tclasses - intellisense shows me all of the plic properties, methods, etc... all looks perfect. No compile errors at all, nothing b gumdropsand lollipops.When I run the app I'm working on that references the class library, it fails at the point where I'm creating an instance of the class and gives me a vague exception, "System.TypeLoadException".

View 2 Replies

Private And Public Class At Class Library

Mar 12, 2011

I'm posting this there is a relationship with my previous post [URL]

I have two projects, namely:

1. Project1 (Windows Application)

2. Project2 (Class Library)

in Project2 there are several classes:

* frmLogin.vb
* frmCustomer.vb
* clsGlobals.vb

in my case, I want to frmLogin.vb and frmCustomer.vb not called in Project1 and I can only call is clsGlobals.vb

View 8 Replies

"upgrade" An Object To An Inherited Class, And Keep All The Base Class's Property Values?

Jul 5, 2010

bare with me during this silly example. :-) Let's say I have a class like this:

Public Class Animal
Public iLegs as int32 ' Number of legs
Public bWings as Boolean ' Wings? Yes/No
End Class

And another class that inherits the "Animal" class and adds one more property:

Public Class ScaryAnimal
Inherits Animal
Public iScariness as int32 ' 0-100, how scary is it?
End Class

Now, if I have an instance of "Animal" with some values in it, and I decide I want to cast it to a ScaryAnimal for some reason, how do I do that without having to create a new instance of "ScaryAnimal" and copy each property value?Basically I'm looking for a way to do this, without having to write the lines marked with '*** below:

[Code]...

View 2 Replies

[02/03] Base Class Called PageBase And Then A Derived Class TestPage That Inherits From PageBase

Feb 4, 2009

I have a base class called PageBase and then a derived class TestPage that inherits from PageBase. In PageBase I have overridden the OnInit() and when it is called and I inspect the value of 'Me', it is of the type of the derived class and not the base class. My question is how does inheritance really work? For instance, when instantiating TestPage does an instance of PageBase get created too?

Here is my code;

Partial Public Class TestPage
Inherits PageBase

Public Sub New()

[code]...

View 7 Replies

What Is The Base Class Of .NET?

Oct 19, 2009

What is the base class of .NET?

View 2 Replies

.net :: AddressOf In Base Class?

Mar 16, 2011

When referencing a method's address, should we take into account the overriding or not?

Class B
Inherits A
Overrides Sub Foo

[code].....

View 2 Replies

C# - Extending The Base Class?

Mar 5, 2010

When you create a webpage in ASP.net, the codebase inherits System.Web.UI.Page Now when I extend the page object to check for SessionExpired for example, I create a new class and inherit from system.web.ui.page, and overwrite some functions. The problem then is that on each page, I have to replace system.web.ui.page with my custompage class. Is there a way to extend a class by adding methods or modifying its methods directly (e.g. add the sessionExpired check to System.Web.UI.Page) ?I'm using .NET 2.0

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved