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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Trouble showing class properties

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

I'm sorry in advance if my explanation isn't very clear. It's a bit hard to put to words what I'm trying to accomplish. That said here we go...

Does anybody know how to show class properties after instantiating the class in code? I have a class Employee and when I type a '.' after the employee object I see a list of properties and functions. The problem comes when I select a property that itself has additional properties.

Employee x = new Employee();

//when i type the '.' after the object "x" I see a list that has "ID," "Department," and "ListOfItems."

x.ID = 10;
x.Department = "Sales"

//I should see a list of properties when i type '.' after the property "ListOfItems" and I do not.

If I enter a valid property of the "ListOfItems" collection class it will let me view the value, but I'd like to see the list none the less.

Any help would be greatly appreciated. Thanks in advance!

View Complete Post

More Related Resource Links

Trouble with UpdateProgress showing...


Recently I converted a project to VS.NET2010 and ASP.NET 4.0 (not convinced this is the problem, but regardless this is when the problem began) and now I am having an issue with an AJAX UpdateProgress showing. Here is the abrriviated code:

   <asp:UpdatePanel ID="UpdatePanelPostPageLoad" runat="server">
         <asp:Timer ID="tmrPostPageLoad" Enabled="false" Interval="100" OnTick="PostPageLoad_LoadData"
         <asp:Timer ID="tmrPostPageLoadPt2" Enabled="false" Interval="1" OnTick="PostPageLoad_LoadDataPt2"
         <%--Placing the UpdateProgress inside the UpdatePanel targeted--%>
         <asp:UpdateProgress ID="UpdateProgressPostPageLoad" runat="server" DisplayAfter="0" AssociatedUpdatePanelID="UpdatePanelPostPageLoad">
                       Updating blah blah....


Abstract class properties work when not implemented?

Hi, I was just looking at a code example and was confused by the behavior of classes implementing an abstract class. So the project has an abstract class named GeneralItem with some abstract properties. Another class named NspItem inherits GeneralItem. NspItem does not implement any of the abstract properties from GeneralItem yet I can write code that successfully sets those properties. How is that working? Is the compiler automatically creating them for me? Example: public abstract class GeneralItem { public string Description { get; set; } } public class NspItem : GeneralItem { public NspItem() { } } static class Program { [STAThread] static void Main() { NspItem item = new NspItem(); item.Description = "Some String"; Console.WriteLine(item.Description); } } //Output would be: Some String

All data in class properties disappear across WCF service

Hi, I have a class that i share betwee silverlight client and wcf service. I populate properties of the class with real data from the client, to be used in the server. I use debugger to step through the code when the call gets to the server, all the data ara gone and are replaced with null. All DateTime value change to 1/1/1001. But if pass primitive types such as int, string, no problem. This is happening only on one machine, but not on ther machine. Can someone tell me what is going on here? Thanks in advance

Trouble assigning properties for multiple CSS classes

Hi Can anyone tell me why the first block of CSS below works, but the second one doesn't? Thanks Block 1: (works) <style type="text/css">  .FB  {      margin-bottom: 0.5in;      margin-left: 0.5in;      text-align: left;      float: left  }  .FB  {      color: Black;  }</style> Block 2: (Doesn't work - all I get for FB is color: Black)<style type="text/css">  .SomeOtherClass, FB  {      margin-bottom: 0.5in;      margin-left: 0.5in;      text-align: left;      float: left  }  .FB  {      color: Black;  }</style>

Search - How to remove a meta tag ... / custom column is not showing up in Crawled Properties after

Hi I got the following warning after I crawled a site. Info out of Crawl Log: "The content for this address was excluded by the crawler because this item was marked with a no-index meta-tag. To index this item, remove the meta-tag and recrawl." Sound easy but I don't no where I could do it. The other problem is that I try to get a custom column from a custom list showing up in the crawle properties. I am using also a custom scope with the behavior "INCLUDE" ... In MOSS 2007 it was a lot simpler ;-) Thanks Regards MIA    

Int properties showing up in debugger as HEX

For some reason, when reading from an Access database, values that are supposed to be INT are showing up as HEXdr["NumSent"]0x00000000dataSet.Tables[0].Rows.Count;0x000004badataSet.Tables[0].Rows.Count.ToString();"1210"Can't for the life of me figure this out.. please help!

Some Useful Properties of Binding Class

When binding the UI control with the data source the Binding class has some useful properties.In this post we will look at them and use them in sample application. The properties which we are going to discuss in this post are the FallbackValue ,TargetNullValue, and StringFormat. Image 1 shows the output of the example code.

Assign values to base class properties


In my controller have a FormViewModel which inherits from a domain class declared in dbml.  In the constructor of the FormViewModel I want to do a shorthand assignment to the inherited class properties with the passed in object (ie thisPerson) without iterating through each property of the inherited class and assigning its value with corresponding property in the passing in object. Should I use super, base, this, or something else?

public MyFormViewModel: Person
  public SelectList Cities {get; private set;}
  public SelectList State {get; private set;}

  public MyFormViewModel(){}

  public MyFormViewModel(Person thisPerson) 

        this = thisPerson; 
     //or super = thisPerson;
     //base = thisPerson;


Serialize a Class's properties as XML Attributes instead if Elements


Say you have a 3rd party provided assembly with a class like so:

User user = new User();

user.UserId = 1;
user.UserName = "johndoe";
user.Password = "password";


When serialized with the XmlSerializer it comes out something like this:


How to create a Class with List<> as properties



I need some help for the above.


I need to read filenames into a List  inside a class.


Example :

1) How to read or get the value into the PhotoNameCollection Class in foreach statement below?


2) How to create a class with List<> as properties and How to do the get and set statement ? Is the below class okk?


 foreach (var pic in PicNames)

     //-- get the filename and add it into the class with List<>


  public class PhotoNameCollection  //<--- Can be Static Class
        private List<string> g_Photoname

        public List<string> PhotoName



.asmx/js missing custom class properties


I have a web method that accepts a class of type Person and simply returns back the same person. I am trying to call this method from an AJAX client. The issue is that the properties of my Person class do not seem to be rendering within the client proxy Person class that is created when accessing MyWebService.asmx/js. Can anyone see what is wrong here?


using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebApplication2
public class Person
public Person(){}

public string Name { get; set; }

/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService1 : System.Web.Services.WebService
public Person EchoPerson(Person person)
return person;


How to set view properties from another class/interface


There is a SearchPage which has a properties ErrorMessage, SuccessMessage etc. This is basically a MVP pattern so for each page(view) there is IView that contains definitions for all the properties

I am using decoratoe pattern to set these peoperties dependingon the message type. There is another Interface IBaseMessage which has a method DisplayMessage() and a class BaseMessage which implements the interface. This class has a definition of the view

Interface IbaseMessage






public Iview _view{get; set;}



_view.Warning ="<message>"



Here, I am not able to set the message to the view properties. I am getting the error as "Object reference not set to an instance of the object"

Somehow the access is not going till theview from the class BaseMessage. I may be missing something. Please help

Appreciate your help!


Question on WorkflowApplication class design ( Func Properties)





I found out that the Workflow Application class offers Func<T> properties to inject code for example when a error occurs.

whats the reason behind the Design Decission of giving the WorkFlow Foundation class Func<T> properties instead of event?


For Example


 Func<WorkflowApplicationUnhandledExceptionEventArgs, UnhandledExceptionAction> OnUnhandledException { get

; set

; }





 Action<WorkflowApplicationCompletedEventArgs> Completed { get

; set

; }


Is it just to prevent the multiple receipients ?

Or is it related to memory mangement due to fix pins caused by eventhandlers ? To be honest i must confess that i'm not sure wether Func<T> will created a fix pin in memory :-(

I'm not sure about if this is good or not, but it would be very nice to get knowledge of the reason why this class is event

Class Properties Not Reflecting Their Changed Values


 I am using a class to track if a user cleared their personal information found within some text boxes on a form. In the button click event to clear the text boxes I am creating a new object to the class and assigning true to one property value. Sounds simple until I try and submit the form with a different button, and create a another object reference that I use in an IF statement to check the property value for true. Every time the statement fails because the value being returned from the getter in my class is false.

This is the class:

Public Class FormStateClass
    'property holds true or false 
    'based on if the user clears the populated form values.
    'True = Form was cleared
    'False = Form was not cleared

    Private _test As Boolean
    Public Property FormState As Boolean
            Return _test
        End Get
        Set(ByVal value As Boolean)
            _test = value
        End Set
    End Property

End Class

This is the code I am using to set the property to true:

Dim thisForm = New FormStateClass With {.FormState = True}

I've also tried these statements:

Class Diagrams

Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation
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