Click here to Skip to main content
12,634,171 members (27,750 online)

.NET Framework

 
GeneralRe: Array of Double - Shallow vs. Deep Cloning? Pin
Mike-MadBadger10-Oct-12 0:04
memberMike-MadBadger10-Oct-12 0:04 
GeneralRe: Array of Double - Shallow vs. Deep Cloning? Pin
Eddy Vluggen10-Oct-12 2:22
memberEddy Vluggen10-Oct-12 2:22 
GeneralOT Pin
Mike-MadBadger10-Oct-12 3:23
memberMike-MadBadger10-Oct-12 3:23 
GeneralRe: OT Pin
Eddy Vluggen10-Oct-12 10:00
memberEddy Vluggen10-Oct-12 10:00 
GeneralRe: Array of Double - Shallow vs. Deep Cloning? Pin
dojohansen10-Oct-12 6:36
memberdojohansen10-Oct-12 6:36 
GeneralRe: Array of Double - Shallow vs. Deep Cloning? Pin
Eddy Vluggen10-Oct-12 10:09
memberEddy Vluggen10-Oct-12 10:09 
QuestionSMS forwarding through GSM modem Pin
Member 94607155-Oct-12 3:57
memberMember 94607155-Oct-12 3:57 
QuestionHow to force rendering to generate an ID? Pin
AtALossHere5-Oct-12 2:13
memberAtALossHere5-Oct-12 2:13 
AnswerRe: How to force rendering to generate an ID? Pin
Sandeep Mewara5-Oct-12 3:24
mvpSandeep Mewara5-Oct-12 3:24 
GeneralRe: How to force rendering to generate an ID? Pin
AtALossHere5-Oct-12 4:26
memberAtALossHere5-Oct-12 4:26 
GeneralRe: How to force rendering to generate an ID? Pin
Sandeep Mewara5-Oct-12 4:30
mvpSandeep Mewara5-Oct-12 4:30 
GeneralRe: How to force rendering to generate an ID? Pin
AtALossHere5-Oct-12 5:51
memberAtALossHere5-Oct-12 5:51 
AnswerRe: How to force rendering to generate an ID? Pin
AtALossHere5-Oct-12 5:58
memberAtALossHere5-Oct-12 5:58 
QuestionCustom Class Exception Management / Setup Pin
Mike-MadBadger4-Oct-12 2:40
memberMike-MadBadger4-Oct-12 2:40 
I'm trying to get my head around a good way to set up exception management in a custom class, if I understand some of the advice in CP articles and elsewhere correctly then something like this setup is 'a' good way:

Simplified case: A class encapsulates a 2D array and has an UpperBound property that takes a an integer and returns the UpperBound of that dimension (since it does not expose the array directly).

Rather than the UpperBound property testing that the integer is either 0 or 1, I should put the call to the array GetUpperBound(dimension) method in a Try block and catch the exceptions that can be thrown by the array method, then re-throw the exception from the encapsulating class with the array exception as the inner exception parameter. Is that smart?

Then if another method in the class uses the UpperBound property (in the encapsulating class) it should catch and re-throw the exceptions created by the UpperBound method (again with the inner exception as a parmater), hence the exception the programmer recieves has a trail directly from the methods they called through whatever path was then followed and ending up with the base exception thrown by the encapculated array.

For example:
''' <summary>
   ''' Gets the upper bound of the specified dimension in the matrix
 ''' </summary>
  ''' <param name="dimension">A zero based dimension of the matrix. Must be zero or one since the a Matrix is two dimensional</param>
   ''' <value></value>
   ''' <returns>The upper bound of the specified dimension</returns>
 ''' <exception cref="IndexOutOfRangeException">This exception is thrown if the specified <paramref name="dimension"/><c> is less than zero or exceeds one, since the a Matrix is two dimensional</c></exception>
    ''' <remarks></remarks>
   Public ReadOnly Property UpperBound(ByVal dimension As Integer) As Integer
        Get
           Try
               Return Me._matrix.GetUpperBound(dimension)
            Catch inex As IndexOutOfRangeException
                Throw New IndexOutOfRangeException("The dimension you specified is out of range for this matrix object. Matrix objects have only two dimensions, 0 and 1. See the inner exception for more detail.", inex)
            Catch ex As Exception
             Throw
         End Try
       End Get
   End Property


Then if I had another method in my class (call it Iterate for example) that needed the UpperBound of the rows (dimension = 0), say to use in a For loop, it would again do this in a Try block, call the UpperBound property and catch the exceptions thrown by the UpperBound property. So if somehow this latter method (Iterate) managed to make a call to UpperBound(2) then the programmer would see the Iterate method throw an IndexOutOfRange exception with the UpperBound exception as its inner exception and that in turn would have the array GertUpperBound exception as an inner exception.

Smart, dumb - other names? Advice?

Mike
AnswerRe: Custom Class Exception Management / Setup Pin
Pete O'Hanlon4-Oct-12 2:50
protectorPete O'Hanlon4-Oct-12 2:50 
GeneralRe: Custom Class Exception Management / Setup Pin
Mike-MadBadger4-Oct-12 3:27
memberMike-MadBadger4-Oct-12 3:27 
GeneralRe: Custom Class Exception Management / Setup Pin
Pete O'Hanlon4-Oct-12 3:32
protectorPete O'Hanlon4-Oct-12 3:32 
QuestionI need an idea for program Pin
Cihangir Giray Han3-Oct-12 23:02
memberCihangir Giray Han3-Oct-12 23:02 
AnswerRe: I need an idea for program Pin
Pete O'Hanlon3-Oct-12 23:08
protectorPete O'Hanlon3-Oct-12 23:08 
GeneralRe: I need an idea for program Pin
Cihangir Giray Han3-Oct-12 23:33
memberCihangir Giray Han3-Oct-12 23:33 
GeneralRe: I need an idea for program Pin
Pete O'Hanlon3-Oct-12 23:39
protectorPete O'Hanlon3-Oct-12 23:39 
GeneralRe: I need an idea for program Pin
Cihangir Giray Han4-Oct-12 2:47
memberCihangir Giray Han4-Oct-12 2:47 
GeneralRe: I need an idea for program Pin
Pete O'Hanlon4-Oct-12 2:51
protectorPete O'Hanlon4-Oct-12 2:51 
QuestionEntity Framework, Import Function Stored Procs & Data Services Pin
Stewart Judson2-Oct-12 0:57
memberStewart Judson2-Oct-12 0:57 
QuestionHow to use FileSystemWatcher Control ? Pin
DEEPAK9489@GMAIL.COM1-Oct-12 17:47
memberDEEPAK9489@GMAIL.COM1-Oct-12 17:47 
AnswerRe: How to use FileSystemWatcher Control ? Pin
JF20151-Oct-12 20:05
memberJF20151-Oct-12 20:05 
AnswerRe: How to use FileSystemWatcher Control ? Pin
Eddy Vluggen2-Oct-12 5:42
memberEddy Vluggen2-Oct-12 5:42 
QuestionHow to know .NET Framework, deeply? Pin
atoi_powered1-Oct-12 13:22
memberatoi_powered1-Oct-12 13:22 
AnswerRe: How to know .NET Framework, deeply? Pin
Eddy Vluggen2-Oct-12 5:40
memberEddy Vluggen2-Oct-12 5:40 
GeneralRe: How to know .NET Framework, deeply? Pin
isenthil2-Oct-12 7:27
memberisenthil2-Oct-12 7:27 
GeneralRe: How to know .NET Framework, deeply? Pin
atoi_powered2-Oct-12 9:23
memberatoi_powered2-Oct-12 9:23 
QuestionCrytal reports Pin
yaswanth0011-Oct-12 2:27
memberyaswanth0011-Oct-12 2:27 
AnswerRe: Crytal reports Pin
Pete O'Hanlon1-Oct-12 2:46
protectorPete O'Hanlon1-Oct-12 2:46 
GeneralRe: Crytal reports Pin
yaswanth0011-Oct-12 8:04
memberyaswanth0011-Oct-12 8:04 
GeneralRe: Crytal reports Pin
Pete O'Hanlon1-Oct-12 10:42
protectorPete O'Hanlon1-Oct-12 10:42 
QuestionAndroid applications Pin
Member 940514026-Sep-12 7:24
memberMember 940514026-Sep-12 7:24 
AnswerRe: Android applications Pin
Richard MacCutchan26-Sep-12 7:32
mvpRichard MacCutchan26-Sep-12 7:32 
AnswerRe: Android applications Pin
Abhinav S1-Oct-12 2:49
mvpAbhinav S1-Oct-12 2:49 
QuestionJagged Array as Return Type from Function - Syntax Driving me Bonkers Pin
Mike-MadBadger25-Sep-12 7:50
memberMike-MadBadger25-Sep-12 7:50 
AnswerRe: Jagged Array as Return Type from Function - Syntax Driving me Bonkers Pin
Richard Deeming4-Oct-12 9:23
memberRichard Deeming4-Oct-12 9:23 
GeneralRe: Jagged Array as Return Type from Function - Syntax Driving me Bonkers Pin
Mike-MadBadger4-Oct-12 21:43
memberMike-MadBadger4-Oct-12 21:43 
GeneralRe: Jagged Array as Return Type from Function - Syntax Driving me Bonkers Pin
Mike-MadBadger4-Oct-12 21:51
memberMike-MadBadger4-Oct-12 21:51 
Questionthe system.__ComObject Pin
majedksa25-Sep-12 2:30
membermajedksa25-Sep-12 2:30 
AnswerRe: the system.__ComObject Pin
Shameel25-Sep-12 2:55
memberShameel25-Sep-12 2:55 
QuestionHelp with system.__ComObject Pin
majedksa25-Sep-12 2:29
membermajedksa25-Sep-12 2:29 
QuestionValidation of viewstate MAC failed. Pin
Sandeepkumar potu24-Sep-12 20:52
memberSandeepkumar potu24-Sep-12 20:52 
AnswerRe: Validation of viewstate MAC failed. Pin
Sandeep Mewara24-Sep-12 21:13
mvpSandeep Mewara24-Sep-12 21:13 
QuestionVB.NET with MSAccess Pin
kkct23-Sep-12 20:35
memberkkct23-Sep-12 20:35 
AnswerRe: VB.NET with MSAccess Pin
Richard MacCutchan23-Sep-12 22:45
mvpRichard MacCutchan23-Sep-12 22:45 
AnswerRe: VB.NET with MSAccess Pin
Mazumder.Soumen25-Sep-12 3:22
memberMazumder.Soumen25-Sep-12 3:22 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 9 Dec 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid