.net - Class Definition Properties Or Methods?

Aug 4, 2010

I have a class definition that I've seen other define properties that return collections of objects.

Public Property GetAllAdults() as Adults End Property I made the argument that this should be a method in the class, because it doesn't define an attribute of the class, and could not be extended with parameters. Is/Are there reasons why this should be defined as a property vs. a function?

View 3 Replies


ADVERTISEMENT

Using Reflection To Find A Properties Definition Class?

May 18, 2008

I am currently using reflection to retrieve all properties of a class. I return a collection of PropertyInfo objects and all is working fine.

My problem is, I want to check if a property has been defined in a base class implementation and is therefore inherited in the current class.

View 2 Replies

VS 2008 Using ENUM Definition In Class Properties?

Jul 28, 2011

In a global module, I define a new type that can take 4 values:

enum tAction as integer
None
Update
Insert
Delete
end enum

A use this type in many places in my code to check the value stored in a variable (if MyAction = tAction.Delete then ...)

In a separate file, I define a class. One of the properties should return a value of this type:

public class XXX
private _Action as tAction
public property ClassAction() as tAction

[Code].....

This way I could check a class property in the same manner (if MyClass.ClassAction = tAction.Insert then ...)

However I get a syntax error in the property definition: 'ClassAction' cannot expose type 'Globals.tAction' outside the project through class 'XXX'

My entire program consists in a few modules, in a single project. How can I use my tAction definition in my classes?

View 4 Replies

Get Properties And Methods For Custom Class?

Oct 29, 2009

Is it possible to iterate through the properties and methods of a custom class, getting the details about those properties and methods in the process.[code]....

View 2 Replies

Nested Class Access Methods For Properties In .NET

Jan 20, 2011

I am trying to figure out the best approach for setting and getting properties in a nested class I am creating. I have a class, Car which has a nested class ControlPanel and want to make the properties of the Control Panel only accessible to the Car and Control Panel class.

[Code]...

View 5 Replies

C# - Does IntelliSense Sometimes Miss-out On Some Framework Class Properties Or Methods

Nov 11, 2010

I came across a DbParameterCollection object, which should have an "Item" property inherited from IList, but IntelliSense does not show this object has the Item property.

View 2 Replies

Can't Access Class Library Methods / Properties When Referenced As A DLL

Oct 15, 2009

I've created a class library and built a dll (release build). I've then referenced the DLL in another project (I've tried several). I can see the namespace and classes in Object Browser and I can declare instances of the classes but I cannot use or see any of the methods or properties! there is no IntelliSense whatsoever and calling the methods manualy results in a 'Declaration expected' error.

Within the class library solution I have a unit test project referencing the class library project which works all works fine (and all the tests pass).

Can anyone provide any pointers to what might be going wrong here? I've built plenty of dlls in the past and have had no trouble referencing them at all.[code]...

View 3 Replies

Hide Methods/properties Of Class-library (dll) From Visual Studio's IntelliSense?

Mar 3, 2009

I am writing my first class-library in VB.NET. My idea is to distribute this library so others may use it in their applications.However, perhaps due to my lack of experience in writing and structuring the library and the classes therein, I noted that the methods/properties are ALL being shown in the IntelliSense of Visual Studio.

The thing is that many of them are only used within the library itself and should NOT be used by the developers (could create a disaster) when they incorporate my library in their application - only a few should be visibile i.e. the ones which are needed by the developer.Thus, my question is: is there a way to hide certain methods/properties of my library from Visual Studio's IntelliSense? Maybe something similar to REM?

EDIT: as mentioned - this is my first library and I now understand that my question could be intepreted in two ways:

1) how to hide something from IntelliSense

2) how to prevent a developer from using and calling certain methods/properties

Of course, the end-result that I want is that the developer is not able to access AT ALL certain methods/properties i.e. No. 2 above.

View 5 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

Making Class Methods Instead Of Instance Methods In .NET?

Mar 29, 2010

I am not sure how clear my question is by the title, but I am trying to make Class methods instead of Instance methods in Visual Basic that way I don't have to waste memory and code creating temporary objects to execute methods that don't need instance variables.

I am not sure if you can do that in VB but I know you can in Objective-C by using either a "+" or "-" sign in front of the method declaration. And in C++ (at least I think, I can't remember) you put the static keyword or const keyword in front of the function.How would I do this in VB if it is possible? Or should I just make a separate set of functions that are not members of a class?

View 2 Replies

Create Array Of Class Definition?

Oct 9, 2006

How do I creat a simple array of class definitions?[code]...

View 13 Replies

Generic Inherited Class Definition

Jan 11, 2010

I'm having trouble with the definition of an inherited generic class. I have two base classes that are defined like this:[code]

View 2 Replies

.net - Separate Metadata From The Class Definition Across Assemblies?

May 24, 2011

I'm working a business layer (separate assembly) that will contain various business entities used in multiple client applications. One of the client applications is a WCF app that will need to serialize these entities. In order to properly serialize the entities, metadata for data contracts or for XML serialization must be added, but the serialization requirements may vary across applications.

Clearly I need the metadata separated from the class definition. So how do I add metadata to my entities for each separate application?

View 1 Replies

Asp.net Mvc - 2 Multiple Model Definition From Linq To Sql Class

Aug 8, 2010

I call upon the VB ninjas out there. Here's my situation. I need to eventually be able to pass multiple models to a view. Currently I have a linq to sql class that, of course, has a bunch of generated model definitions. I need to make a model that implements multiple models. I somewhat understand how to do this in C#, but this project is testing my VB skillz. Here's some snippets from my linq to sql models. I need to combine these two into one model to pass to the view.

[Code]...

View 1 Replies

C# - Extending Enumeration Definition In A Child Class In .NET?

Jan 4, 2010

I have a base class which needs to define an enumeration:

BaseClass
- SomeEnum

I then need to create two derived classes from the base class and extend the values in the enumeration:

ChildClass1 : BaseClass
- SomeEnum
- SomeEnumValue1

[code]....

In C# or VB.NET can someone provide the syntax to do this?

View 3 Replies

Extend Class Definition Across Multiple Files?

Feb 10, 2010

In order to organize various methods of my MainForm class, I would like to categorize them into several files. Of course, the methods would still need to access form elements and additional variables I added in the MainForm class.

View 3 Replies

Get Base Class Object Reference Outside It's Definition?

Feb 13, 2012

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 .[code]...

View 6 Replies

Instantiate Object Inside Class Definition

Jun 22, 2010

I see a sample code that an object is instantiated within the class definition block. But when I test the folllowing, I got error "Process is terminated due to

[Code]...

View 3 Replies

VS 2005 Counter Class Definition Loops?

Sep 14, 2009

I have 3 classes that need themselves in order to do their work but if I declare them the old way it would end up being an endless loop.

As an ex C++ programmer, I know I could use include once but I don't know if there is any equivalency in vb.net Here is the picture.

I have 3 Classes : SQLConnector, ErrorHandler, LogHandler

- ErrorHandler needs SQLConnector to get some IDs from the Database.

- ErrorHandler needs the LogHandler class to prepare the Logs to be... logged.

- SQLConnector needs the ErrorHandler class in case there is errors happening.

- LogHandler needs SQLConnector to insert in the database.

- LogHandler needs ErrorHandler in case the insert is not successful (sends mail in that case)

As you can see, all three classes are needed. The reason why I can't use LogHandler and ErrorHandler as one class is that I will use that class to log transactions and changes according to some parameters. Log is in no way exclusive to ErrorHandler.how I can prevent to make an endless loop and use all three of them as I wish?

View 11 Replies

Class Definition To Return Nested JSON Structure Without WCF?

Dec 10, 2011

I'm trying to return code like this (can be found here):

{"hotspots": [{
"id": "test_1",
"anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } },

[code].....

View 2 Replies

Definition - Class - Object - Inheritance - Polymorphism - Abstraction

Mar 8, 2010

Can you define this :

Class
Object
Inheritance
Polymorphism
Abstraction

And could you make it easy to understand I'm having a hard time to understand those terms.

View 7 Replies

.net - Invoking COM Properties And Methods

Nov 22, 2010

I am trying to dynamically create COM object, call COM method and set COM properties. The COM class is a VB6 ActiveX DLL. The implementation is exactly equal to the VB6 code from this page

[Code]...

View 1 Replies

Access Methods Or Properties From Html In Asp.net Mvc?

Dec 4, 2009

In c# asp.net mvc I can declare some public class like:

public class Foo {
public static string Bar {get
{return "bar";}
}
}

and access it from any html like:

<%=Foo.Bar;%>

right?Well, I have to do the same in ASP.NET MVC VB.Net but I cannot access any variable or method:

public class Foo
public Shared ReadOnly Bar as string
Get

[code]....

UPDATE:standard VB.NET puts modules in the namespace defined in your project.I had to type

MVCApplication1.Foo.Bar

how to create a module that doesn't wrap this into a namespace? Or have the view import the application namespace by default?

View 2 Replies

OOP - Shared Methods And Base Properties?

Feb 25, 2009

If you can't use Me. in a non-instance method, how would you use properties/functions from a base class in a Shared method?

For example, ClassB inherits from ClassA
ClassB has a Shared Method DoWork();
ClassA has a ReadOnly Property SecurityKey

How do I Public Sub DoWork() Dim test as String = Me.SecurityKey End Sub

View 5 Replies

Use Control Name To Access Properties And Methods?

Sep 3, 2009

I have a sub (Sub 1)that passes a control to another sub (Sub2) Sub2 only knows that the control will either be a picturebox ("Pict1") or a rich textbox ("Rchtxbx").I want to put code in Sub2 that does the following if the control that is passed is aPictureBox:ictureBox1.Load("C est.bmp")However I don't know how to do this as when I type in "x" in Sub2, it does not default to the PictureBox properties and methods.Is it possible to use the name of a control and wrap it in some sort of ControlType() enclosure that identifies its type and grants access to its properties and methods?

View 1 Replies

Using String Properties/methods To Evaluate A Number?

May 4, 2012

I have one text box that the user enters an integer into. I use a select case to determine what the length of the number is. (along w/ string.length, etc)based on how long it is, I can determine if the number is 1-9, 10-99, 100-999, etc. What I want to do next is, evaluate the number and display a roman numeral that matches.

intMyNumber.substring(1,?) ' 1 would return the leftmost number
if intMyNumber.substring(1,?) = 1 then
if intMyNumber.substring(2,?) = 1 then 'etc

[code]....

View 3 Replies

Compiler - External-only Properties Or Methods - From The Internal Namespace?

Nov 30, 2009

Is there a simple way in vb.net to mask a public property or method from the internal namespace? It would be helpful as a refactoring tool to isolate internal dependencies and perhaps to enforce a non-recursion policy for external services.

View 2 Replies

Sender As Object IntelliSense Only Lists 5 Methods And No Properties

Feb 3, 2012

When you type sender. IntelliSense lists 5 methods and yet if you type sender.Left or sender.top these will work. Why don't these properties show up as available for use via IntelliSense.

View 2 Replies

VS 2008 - Annotating Functions / Sub Routines / Methods And Properties

Mar 25, 2010

Is there a way to annotate functions, subs, properties, and methods so that tool tips will pop-up in the IDE as they're being defined or selected?

View 2 Replies

Create An Windows User Control With Events Properties, Methods

Apr 11, 2012

I was looking for a tutorial and i find this

[URL]

but it does not give the sample code for creating a user control with properties, events, methods

complete to create windows user control? that includes creating properties, events, methods? and if it has how to create web user controls better

View 1 Replies







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