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 370503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:01:27+00:00 2026-05-12T14:01:27+00:00

o will always come from an entiryRef/TEntity (from linq 2 sql) I’m ok with

  • 0

o will always come from an entiryRef/TEntity (from linq 2 sql)

I’m ok with a c# or vb.net solution (I will convert it into vb.net if you can’t)

Public Function desc(Of t)(ByRef o As t, Optional ByVal PropPrefix As String = "desc") As String
    If o Is Nothing Then
        Return ""
    Else
        Dim bind = Reflection.BindingFlags.Public Or Reflection.BindingFlags.IgnoreCase Or Reflection.BindingFlags.Instance
        Dim _desc = PropPrefix & If(var.Sess.lang = Sess.elang.en, PropPrefix & "en", "fr")
        Dim pinfo As Reflection.PropertyInfo = o.GetType.GetProperty(_desc, bind)

        Return pinfo.GetValue(o, Nothing).ToString
    End If
End Function

little background

I have a database like this

tableUser
-----------------
id
name
countryid

tableCountry
--------
countryid
descEn
descFr

when I’m showing the information about a user, I want to easily show the good language selected in the application

that one example, I have lots more table and lot more lookup table

with linq 2 sql if the field in the database is null, the object will be “nothing”(null) and I’m catching that with the first if then I’m getting the corresponding language field

  • 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-12T14:01:28+00:00Added an answer on May 12, 2026 at 2:01 pm

    Unfortunately, runtime reflection will be required unless you can integrate a desc method into each object, perhaps through some sort of entity base class or code generation and partial classes.

    The code generation approach: For each entity class, if it contains one or more descFoo properties, generate a desc property that pulls the correct one. If you cannot modify the CodeDom before it is written, you can also compile the entity classes, reflect/introspect the results, generate partial classes, and recompile with the added code.

    Since these are entity classes, though, it appears to me as though a schema change might be preferable. Rather than using multiple descFoo columns, add a table consisting of {entity PK, language, text}.

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

Sidebar

Ask A Question

Stats

  • Questions 192k
  • Answers 192k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well it's not rails. It's html. <input type="password" name="password" />… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer Yes, it does make sense to have multiple threads. Specially… May 12, 2026 at 6:26 pm
  • Editorial Team
    Editorial Team added an answer I'v used ezPublish for quite a while and I can… May 12, 2026 at 6:26 pm

Related Questions

I am writing an application in java (1.6) using swing. I currently have a
i would like to do FILE I/O without a dialogue. the file always be
I need to build a sqlserver query that if a text column has a
Looking at the implementation on Wikipedia, it would seem that a standard BST (non
I'm working on some code for a loosely coupled cluster. To achieve optimal performance

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.