Created
October 19, 2012 02:48
-
-
Save bleis-tift/3915964 to your computer and use it in GitHub Desktop.
処理結果コードマジクソ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hoge | |
{ | |
// 処理結果コードを返す | |
public string Piyo(...) { ... } | |
public readonly int ResultA; | |
public readonly string ResultB; | |
} | |
var code = h.Piyo(...); | |
if (code == "000") | |
{ | |
// 処理結果コードが正常を表す場合は結果が取れるよ! | |
// 結果はintとかstringとか、かなり原始的な型で、プロパティとして取得するよ! | |
var hoge = h.ResultA; | |
var piyo = h.ResultB; | |
// ... | |
} | |
else | |
{ | |
// それ以外の結果コードは、何かおかしいことを表すよ! | |
// しかも、コードによって情報を持ってたりもするけど、 | |
// それはドキュメントに記されているだけなのでドキュメントがないとその情報を取り出すことはできないよ! | |
if (code[0] == '2') | |
{ | |
var hogeFlag = code[3] == '1'; | |
var piyoFlag = code[3] == '2'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment