Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 682537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:36:25+00:00 2026-05-14T01:36:25+00:00

Two function should be implemented, and I am wondering what type of validation I

  • 0

Two function should be implemented, and I am wondering what type of validation I need to do on inputs and how to manage errors.

Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert

End Function

Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack

End Function

I need to check if the type of value and the type of parameter are what I am expecting.

In case they are not, should I return nothing and catch the wrong behavior in another place? Or should I throw here an exception or an assert?

Is there any best or suggested practices to apply here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:36:25+00:00Added an answer on May 14, 2026 at 1:36 am

    Personally i check for the type and value, then convert it. If for any reason it cannot be converted then i simply return value unconverted. I don’t throw any exceptions or do any logging – most of the time it is easy to see if a conversion has failed because you don’t see the expected item in the UI. Logging errors in a converter could be quite expensive, hence why i avoid it.

    The data binding (usually) fails silently (i have had binding with a converter throw a big massive fit once in Silverlight), you can check the Output window for any errors, and it is pretty simple to whack a conditional breakpoint in the converter if necessary to debug any issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two WIN32 DLL projects in the solution, main.dll should call a function
I have two function and I need to execut in one onClick . The
I need to execute a specific function mvFinishItUp() when two conditions are met. More
I write two function, which callback will be invoke by the fn : var
What is difference between the following two function definitions? A 2D array is being
using VS 2010 with full optimization /Ox look at the following two function calls:
Suppose I have two constructor function: var Person = function(xx,xx,xxx,xxxxxxx) { //Person initialization }
Given the following two objects: function newDoodle() { var Doodle = { /* Variables
For example suppose I have the following two functions function a(param1) { console.log(param1); }
I have an IF statement that consists of two separate function calls passing values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.