Home>

c# always exception handling by callingtry-catchThere is a function that I want you toSWIFTIfthrowsI think I can do it, but c# or this is possible?

If you are writing a question, you can see what you want to hear. SWIFT error handling is roughly summarized, [SWIFT] Error handling The article that has learned about throws /throw /TRY /DO /CATCH that Throws may be able to throw an exception from that method It seems like the information indicated by the attribute and type, but it is unknown if the question content is related or not. If it is a story in c#, it may be a pseudo-cord, so write outline processing of caller /call destination and write what kind of wind to be in any part of them It seems.

kunif2021-07-21 16:25:08

The relationship with the question is unknown, but there is also a Throws to Java, and it seems that it seems that it seems that you do not adopt such things in c#. Checking exceptions in Java and not c# Reason, Java usage may study c# c# that it may be a concept that leads to the answers of exception handling @sayuri.

kunif2021-07-21 16:25:08

I agree. I was not understandable to write. "Do you have a syntax equivalent to SWIFT Throws in c#?" Thank you for introducing articles.

zunda2021-07-21 16:25:08
c#
  • Answer # 1

    c# If not tries to the exception that occurred, the program stops. It is a c# design concept that it should not continue the program is the calling side and should not be controlled by the library provided side.

    Even if it is any error, it should not throw an exception if it is expected. For example

    • Persose, and if it is not possible, throw an exception
    • Personal may not be able to parse, and if it can not be done, it represents the return value
    • Standard class library is designed as

      .


      c# Is there a syntax equivalent to SWIFT Throws?

      I can not read from the above answer. c# language does not exist such syntax. c# Not adopted in the language design= The reason why it was judged that it is not necessary.

      If c#, this function should be ry-catch? I can not understand that, but is there no way to deal with it?

      zunda2021-07-21 16:25:08
  • Answer # 2

    c# If not tries to the exception that occurred, the program stops. It is a c# design concept that it should not continue the program is the calling side and should not be controlled by the library provided side.

    Even if it is any error, it should not throw an exception if it is expected. For example

    • Persose, and if it is not possible, throw an exception
    • Personal may not be able to parse, and if it can not be done, it represents the return value
    • Standard class library is designed as

      .


      c# Is there a syntax equivalent to SWIFT Throws?

      I can not read from the above answer. c# language does not exist such syntax. c# Not adopted in the language design= The reason why it was judged that it is not necessary.

      If c#, this function should be ry-catch? I can not understand that, but is there no way to deal with it?

      zunda2021-07-21 16:25:08
  • Answer # 3

    It seems to be a concept of checked exception (CHECKED Exception), but it seems that c# is not supported.

    Java supports checked exceptions in addition to unchecked exceptions. c# is only non-check exception. The checked exception needs to declare and capture all the programmers that can occur from the method.
    Some of the checked exceptions are very useful because they can be handled that all errors are processed. Meanwhile, like Anders Healthburg, a c# designer, Java's checked exception is some experimental specifications, and it is not possible to find value to be implemented except for examples in a small program Some people are.

    The difference in the way of thinking of language designer (group?).
    c# If you are aware of such things, SWIFT and Java are supporting support.

    SWIFT
    I tried to put together a lot about SWIFT error handling
    [SWIFT] Error handling about throws /throw /TRY /DO /CATCH

    Java & c#
    Rethinking exception
    Java usage studies c# Part 8 Exception handling

    c#

    The above selfish Japanese language The trouble with checked exceptions
    Checked Exceptions ARE EVIL


    "Is there a syntax equivalent to SWIFT throws in c#?"
    → It is thought that there is no.

    "c# If this function should be RY-CATCH, it is not possible to understand, but is there no action to be dealt with?"
    → Enhance the document and write in it, and when using it, you will read the document well.
    → If you create and write an XML document to the answer of the following article, IDE will assist IDE? It seems that there is.
    One of the answers/ Another answer

    The English version StackOverflow has an article of questions and similar articles.
    HOW TO USE Java-Style Throws Keyword in c#?

  • Answer # 4

    It seems to be a concept of checked exception (CHECKED Exception), but it seems that c# is not supported.

    Java supports checked exceptions in addition to unchecked exceptions. c# is only non-check exception. The checked exception needs to declare and capture all the programmers that can occur from the method.
    Some of the checked exceptions are very useful because they can be handled that all errors are processed. Meanwhile, like Anders Healthburg, a c# designer, Java's checked exception is some experimental specifications, and it is not possible to find value to be implemented except for examples in a small program Some people are.

    The difference in the way of thinking of language designer (group?).
    c# If you are aware of such things, SWIFT and Java are supporting support.

    SWIFT
    I tried to put together a lot about SWIFT error handling
    [SWIFT] Error handling about throws /throw /TRY /DO /CATCH

    Java & c#
    Rethinking exception
    Java usage studies c# Part 8 Exception handling

    c#

    The above selfish Japanese language The trouble with checked exceptions
    Checked Exceptions ARE EVIL


    "Is there a syntax equivalent to SWIFT throws in c#?"
    → It is thought that there is no.

    "c# If this function should be RY-CATCH, it is not possible to understand, but is there no action to be dealt with?"
    → Enhance the document and write in it, and when using it, you will read the document well.
    → If you create and write an XML document to the answer of the following article, IDE will assist IDE? It seems that there is.
    One of the answers/ Another answer

    The English version StackOverflow has an article of questions and similar articles.
    HOW TO USE Java-Style Throws Keyword in c#?