Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
AnswerRe: PropertyGrid scrolls to selected property Pin
joegood10-Oct-05 6:21
joegood10-Oct-05 6:21 
QuestionFinding the volume level of the currently recording audio? Pin
karl6438-Oct-05 17:16
karl6438-Oct-05 17:16 
QuestionAccessing property values using GetValue() Pin
mossu8-Oct-05 16:35
mossu8-Oct-05 16:35 
AnswerRe: Accessing property values using GetValue() Pin
Guffa9-Oct-05 0:22
Guffa9-Oct-05 0:22 
GeneralRe: Accessing property values using GetValue() Pin
mossu9-Oct-05 2:38
mossu9-Oct-05 2:38 
GeneralRe: Accessing property values using GetValue() Pin
Guffa9-Oct-05 8:50
Guffa9-Oct-05 8:50 
GeneralRe: Accessing property values using GetValue() Pin
mossu10-Oct-05 3:01
mossu10-Oct-05 3:01 
AnswerRe: Accessing property values using GetValue() Pin
S. Senthil Kumar9-Oct-05 3:18
S. Senthil Kumar9-Oct-05 3:18 
This piece of code seems to work fine.
private void CheckNumericValues(object instance)
{
   foreach(PropertyInfo propertyInfo in instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
   {
      if (propertyInfo.PropertyType == typeof(System.Int32))
      {
         object val = propertyInfo.GetValue(instance, null);
         Assert.AreEqual((int)val, 0);
       }
    }
}

Of course, it works for only properties returning int, you'd have to write separate if conditions for each numerical type if you want generic numeric value checking.

Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
GeneralRe: Accessing property values using GetValue() Pin
mossu9-Oct-05 6:05
mossu9-Oct-05 6:05 
QuestionOODBMS are the best solution for Today applications Pin
tolgayikilmaz8-Oct-05 12:16
tolgayikilmaz8-Oct-05 12:16 
AnswerRe: OODBMS are the best solution for Today applications Pin
johhnny8-Oct-05 12:20
johhnny8-Oct-05 12:20 
AnswerRe: OODBMS are the best solution for Today applications Pin
Colin Angus Mackay8-Oct-05 22:26
Colin Angus Mackay8-Oct-05 22:26 
GeneralRe: OODBMS are the best solution for Today applications Pin
tolgayikilmaz9-Oct-05 1:45
tolgayikilmaz9-Oct-05 1:45 
GeneralRe: OODBMS are the best solution for Today applications Pin
Colin Angus Mackay9-Oct-05 1:48
Colin Angus Mackay9-Oct-05 1:48 
AnswerRe: OODBMS are the best solution for Today applications Pin
Kevin McFarlane9-Oct-05 8:29
Kevin McFarlane9-Oct-05 8:29 
QuestionOpening the Form in maximized mode? Pin
E6AD8-Oct-05 12:09
E6AD8-Oct-05 12:09 
AnswerRe: Opening the Form in maximized mode? Pin
S. Senthil Kumar8-Oct-05 20:03
S. Senthil Kumar8-Oct-05 20:03 
QuestionWindowScraping Pin
budidharma8-Oct-05 11:17
budidharma8-Oct-05 11:17 
AnswerRe: WindowScraping Pin
XRaheemX10-Oct-05 5:06
XRaheemX10-Oct-05 5:06 
QuestionTaskbar Applications Pin
jgallen238-Oct-05 11:13
jgallen238-Oct-05 11:13 
QuestionRichTextBox Qeustion Pin
Mohammad A Gdeisat8-Oct-05 10:45
Mohammad A Gdeisat8-Oct-05 10:45 
AnswerRe: RichTextBox Qeustion Pin
mav.northwind9-Oct-05 0:31
mav.northwind9-Oct-05 0:31 
QuestionThreads Pin
ShimiG8-Oct-05 8:32
ShimiG8-Oct-05 8:32 
AnswerRe: Threads Pin
S. Senthil Kumar8-Oct-05 20:07
S. Senthil Kumar8-Oct-05 20:07 
GeneralRe: Threads Pin
ShimiG9-Oct-05 4:27
ShimiG9-Oct-05 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.